def to_proto(
        self,
        tag,
        msg=None,
        *,
        constants: list[v2.program_pb2.Constant],
        raw_constants: dict[Any, int],
    ) -> v2.program_pb2.Tag | None:
        """Converts tag to proto using this serializer.

        If self.can_serialize_tag(tag) == False, this should return None.

        Args:
            tag: The tag to be serialized.
            msg: An optional proto object to populate with the serialization
                results.
            constants: The list of previously-serialized Constant protos.
            raw_constants: A map raw objects to their respective indices in
                `constants`.

        Returns:
            The proto-serialized version of `tag`. If `msg` was provided, it is
            the returned object.
        """
Converts tag to proto using this serializer.

        If self.can_serialize_tag(tag) == False, this should return None.

        Args:
            tag: The tag to be serialized.
            msg: An optional proto object to populate with the serialization
                results.
            constants: The list of previously-serialized Constant protos.
            raw_constants: A map raw objects to their respective indices in
                `constants`.

        Returns:
            The proto-serialized version of `tag`. If `msg` was provided, it is
            the returned object.
        
cirq-google/cirq_google/serialization/tag_serializer.py