def __init__(
        self, num_qubits: int | None = None, qid_shape: tuple[int, ...] | None = None
    ) -> None:
        """Inits IdentityGate.

        Args:
            num_qubits: The number of qubits for the identity gate.
            qid_shape: Specifies the dimension of each qid the measurement
                applies to.  The default is 2 for every qubit.

        Raises:
            ValueError: If the length of qid_shape doesn't equal num_qubits, or
                neither `num_qubits` or `qid_shape` is supplied.

        """
        if qid_shape is None:
            if num_qubits is None:
                raise ValueError('Specify either the num_qubits or qid_shape argument.')
            qid_shape = (2,) * num_qubits
        elif num_qubits is None:
            num_qubits = len(qid_shape)
        self._qid_shape = qid_shape
        if len(self._qid_shape) != num_qubits:
            raise ValueError('len(qid_shape) != num_qubits')
Inits IdentityGate.

        Args:
            num_qubits: The number of qubits for the identity gate.
            qid_shape: Specifies the dimension of each qid the measurement
                applies to.  The default is 2 for every qubit.

        Raises:
            ValueError: If the length of qid_shape doesn't equal num_qubits, or
                neither `num_qubits` or `qid_shape` is supplied.

        
cirq-core/cirq/ops/identity.py