def __init__(
        self,
        observable: cirq.BaseDensePauliString | Iterable[cirq.Pauli],
        key: str | cirq.MeasurementKey = '',
    ) -> None:
        """Inits PauliMeasurementGate.

        Args:
            observable: Pauli observable to measure. Any `Iterable[cirq.Pauli]`
                is a valid Pauli observable (with a +1 coefficient by default).
                If you wish to measure pauli observables with coefficient -1,
                then pass a `cirq.DensePauliString` as observable.
            key: The string key of the measurement.

        Raises:
            ValueError: If the observable is empty.
        """
        if not observable:
            raise ValueError(f'Pauli observable {observable} is empty.')
        if not all(
            isinstance(p, pauli_gates.Pauli) for p in cast(Iterable['cirq.Gate'], observable)
        ):
            raise ValueError(f'Pauli observable {observable} must be Iterable[`cirq.Pauli`].')
        coefficient = (
            observable.coefficient if isinstance(observable, dps.BaseDensePauliString) else 1
        )
        if coefficient not in [+1, -1]:
            raise ValueError(
                f'`cirq.DensePauliString` observable {observable} must have coefficient +1/-1.'
            )

        self._observable = dps.DensePauliString(observable, coefficient=coefficient)
        self._mkey = (
            key if isinstance(key, value.MeasurementKey) else value.MeasurementKey(name=key)
        )
Inits PauliMeasurementGate.

        Args:
            observable: Pauli observable to measure. Any `Iterable[cirq.Pauli]`
                is a valid Pauli observable (with a +1 coefficient by default).
                If you wish to measure pauli observables with coefficient -1,
                then pass a `cirq.DensePauliString` as observable.
            key: The string key of the measurement.

        Raises:
            ValueError: If the observable is empty.
        
cirq-core/cirq/ops/pauli_measurement_gate.py