def intersection_subset(self, other: _QidShapeSet):
        """Return a subset of the intersection with other qid shape set."""
        explicit_qid_shapes = self.explicit_qid_shapes & other.explicit_qid_shapes
        unfactorized_total_dimension = None
        min_qudit_dimensions = None

        if self.explicit_qid_shapes and other.unfactorized_total_dimension is not None:
            explicit_qid_shapes |= _intersection_explicit_with_unfactorized_qid_shapes(
                self.explicit_qid_shapes, other.unfactorized_total_dimension
            )

        if self.explicit_qid_shapes and other.min_qudit_dimensions:
            explicit_qid_shapes |= _intersection_explicit_with_min_qudit_dims_qid_shapes(
                self.explicit_qid_shapes, other.min_qudit_dimensions
            )

        if self.unfactorized_total_dimension is not None and other.explicit_qid_shapes:
            explicit_qid_shapes |= _intersection_explicit_with_unfactorized_qid_shapes(
                other.explicit_qid_shapes, self.unfactorized_total_dimension
            )

        if self.unfactorized_total_dimension == other.unfactorized_total_dimension:
            unfactorized_total_dimension = self.unfactorized_total_dimension

        if self.min_qudit_dimensions is not None and other.explicit_qid_shapes:
            explicit_qid_shapes |= _intersection_explicit_with_min_qudit_dims_qid_shapes(
                other.explicit_qid_shapes, self.min_qudit_dimensions
            )

        if self.min_qudit_dimensions is not None and other.min_qudit_dimensions is not None:
            min_qudit_dimensions = _intersection_min_qudit_dims_qid_shapes(
                self.min_qudit_dimensions, other.min_qudit_dimensions
            )

        # Above, we only intersected 7 pairs of sets even though there are 9 possible pairs.
        # We omitted the 2 pairs involving unfactorized total dimension and min qudit dimensions
        # because that calculation is inefficient.

        return _QidShapeSet(
            explicit_qid_shapes=explicit_qid_shapes,
            unfactorized_total_dimension=unfactorized_total_dimension,
            min_qudit_dimensions=min_qudit_dimensions,
        )
Return a subset of the intersection with other qid shape set.
cirq-core/cirq/qis/states.py