def from_proto(
        self,
        proto: v2.program_pb2.Operation,
        *,
        constants: list[v2.program_pb2.Constant],
        deserialized_constants: list[Any],
    ) -> cirq.Operation:
        """Turns a cirq_google Operation proto into a stimcirq object.

        Args:
            proto: The proto object to be deserialized.
            constants: The list of Constant protos referenced by constant
                table indices in `proto`. This list should already have been
                parsed to produce 'deserialized_constants'.
            deserialized_constants: The deserialized contents of `constants`.

        Returns:
            The deserialized stimcirq object

        Raises:
            ValueError: If stimcirq is not installed or the object is not recognized.
        """
        resolvers = _stimcirq_json_resolvers()
        cls_name = proto.internalgate.name

        if cls_name not in resolvers:
            raise ValueError(f"stimcirq object {proto} not recognized. (Is stimcirq installed?)")

        # Resolve each of the serialized arguments
        kwargs: dict[str, Any] = {}
        for k, v in proto.internalgate.gate_args.items():
            if k == "pauli":
                # Special Handling for pauli gate
                pauli = v.arg_value.string_value
                if pauli == "X":
                    kwargs[k] = cirq.X
                elif pauli == "Y":
                    kwargs[k] = cirq.Y
                elif pauli == "Z":
                    kwargs[k] = cirq.Z
                else:
                    raise ValueError(f"Unknown stimcirq pauli Gate {v}")
                continue

            arg = arg_func_langs.arg_from_proto(v)
            if arg is not None:
                kwargs[k] = arg

        # Instantiate the class from the stimcirq resolvers
        op = resolvers[cls_name](**kwargs)

        # If this operation has qubits, add them
        qubits = [deserialized_constants[q] for q in proto.qubit_constant_index]
        if qubits:
            op = op(*qubits)

        return op
Turns a cirq_google Operation proto into a stimcirq object.

        Args:
            proto: The proto object to be deserialized.
            constants: The list of Constant protos referenced by constant
                table indices in `proto`. This list should already have been
                parsed to produce 'deserialized_constants'.
            deserialized_constants: The deserialized contents of `constants`.

        Returns:
            The deserialized stimcirq object

        Raises:
            ValueError: If stimcirq is not installed or the object is not recognized.
        
cirq-google/cirq_google/serialization/stimcirq_deserializer.py