def _tuple_to_proto(value: list | tuple | set | frozenset, out: v2.program_pb2.Tuple):
    """Converts a tuple of mixed values to Arg protos."""
    if isinstance(value, list):
        out.sequence_type = v2.program_pb2.Tuple.SequenceType.LIST
    elif isinstance(value, tuple):
        out.sequence_type = v2.program_pb2.Tuple.SequenceType.TUPLE
    elif isinstance(value, set):
        out.sequence_type = v2.program_pb2.Tuple.SequenceType.SET
    elif isinstance(value, frozenset):
        out.sequence_type = v2.program_pb2.Tuple.SequenceType.FROZENSET
    else:
        out.sequence_type = v2.program_pb2.Tuple.SequenceType.UNSPECIFIED  # pragma: nocover
    for arg in value:
        new_arg = out.values.add()
        arg_to_proto(arg, out=new_arg)
Converts a tuple of mixed values to Arg protos.
cirq-google/cirq_google/serialization/arg_func_langs.py