def __init__(self, p: float, n_qubits: int = 1) -> None:
        """Constructs a depolarization channel on several qubits.

        Args:
            p: The probability that one of the Pauli gates is applied. Each of
                the Pauli gates is applied independently with probability
                $p / (4^n - 1)$.
            n_qubits: the number of qubits.

        Raises:
            ValueError: if p is not a valid probability.
        """

        error_probabilities = {}

        p_depol = p / (4**n_qubits - 1)
        p_identity = 1.0 - p
        for pauli_tuple in itertools.product(['I', 'X', 'Y', 'Z'], repeat=n_qubits):
            pauli_string = ''.join(pauli_tuple)
            if pauli_string == 'I' * n_qubits:
                error_probabilities[pauli_string] = p_identity
            else:
                error_probabilities[pauli_string] = p_depol

        self._p = p
        self._n_qubits = n_qubits

        self._delegate = AsymmetricDepolarizingChannel(error_probabilities=error_probabilities)
Constructs a depolarization channel on several qubits.

        Args:
            p: The probability that one of the Pauli gates is applied. Each of
                the Pauli gates is applied independently with probability
                $p / (4^n - 1)$.
            n_qubits: the number of qubits.

        Raises:
            ValueError: if p is not a valid probability.
        
cirq-core/cirq/ops/common_channels.py