def clifford_tableau_arg_to_proto(
    value: CliffordTableau, *, out: v2.program_pb2.CliffordTableau | None = None
):
    """Writes an CliffordTableau object into an CliffordTableau proto.
    Args:
        value: The gate to encode.
        out: The proto to write the result into. Defaults to a new instance.
    Returns:
        The proto that was written into.
    """
    msg = v2.program_pb2.CliffordTableau() if out is None else out
    msg.num_qubits = value.n
    msg.initial_state = value.initial_state
    msg.xs.extend(map(bool, value.xs.flatten()))
    msg.rs.extend(map(bool, value.rs.flatten()))
    msg.zs.extend(map(bool, value.zs.flatten()))
    return msg
Writes an CliffordTableau object into an CliffordTableau proto.
    Args:
        value: The gate to encode.
        out: The proto to write the result into. Defaults to a new instance.
    Returns:
        The proto that was written into.
    
cirq-google/cirq_google/serialization/arg_func_langs.py