[ _bool_
](https://docs.python.org/3/library/functions.html#bool "\(in Python v3.10\)")
) – If true, requests deterministic serialization of the protobuf, with
predictable ordering of map keys.

Returns  :

    

A serialized representation of the partial message.

Return type  :

    

[ bytes ](https://docs.python.org/3/library/stdtypes.html#bytes "\(in Python
v3.10\)")

` SerializeToString ` (  _**kwargs_ )  ¶

    

Serializes the protocol message to a binary string.

Keyword Arguments  :

    

**deterministic** ( [ _bool_
](https://docs.python.org/3/library/functions.html#bool "\(in Python v3.10\)")
) – If true, requests deterministic serialization of the protobuf, with
predictable ordering of map keys.

Returns  :

    

A binary string representation of the message if all of the required fields in
the message are set (i.e. the message is initialized).

Raises  :

    

**EncodeError** – if the message isn’t initialized (see  ` IsInitialized()  `
).

` SetInParent ` (  )  ¶

    

Mark this as present in the parent.

This normally happens automatically when you assign a field of a sub-message,
but sometimes you want to make the sub-message present while keeping it empty.
If you find yourself using this, you may want to reconsider your design.

` UnknownFields ` (  )  ¶

    

Returns the UnknownFieldSet.

Returns  :

    

The unknown fields stored in this message.

Return type  :

    

[ UnknownFieldSet
](internal/containers.html#google.protobuf.internal.containers.UnknownFieldSet
"google.protobuf.internal.containers.UnknownFieldSet")

` WhichOneof ` (  _oneof_group_ )  ¶

    

Returns the name of the field that is set inside a oneof group.

If no field is set, returns None.

Parameters  :

    

**oneof_group** ( [ _str_
](https://docs.python.org/3/library/stdtypes.html#str "\(in Python v3.10\)") )
– the name of the oneof group to check.

Returns  :

    

The name of the group that is set, or None.

Return type  :

    

[ str ](https://docs.python.org/3/library/stdtypes.html#str "\(in Python
v3.10\)") or [ None ](https://docs.python.org/3/library/constants.html#None
"\(in Python v3.10\)")

Raises  :

    

[ **ValueError**
](https://docs.python.org/3/library/exceptions.html#ValueError "\(in Python
v3.10\)") – no group with the given name exists

###  [ Table of Contents ](../../index.html)

  * [ google.protobuf ](../protobuf.html)
  * [ google.protobuf.any_pb2 ](any_pb2.html)
  * [ google.protobuf.descriptor ](descriptor.html)
  * [ google.protobuf.descriptor_database ](descriptor_database.html)
  * [ google.protobuf.descriptor_pb2 ](descriptor_pb2.html)
  * [ google.protobuf.descriptor_pool ](descriptor_pool.html)
  * [ google.protobuf.duration_pb2 ](duration_pb2.html)
  * [ google.protobuf.empty_pb2 ](empty_pb2.html)
  * [ google.protobuf.field_mask_pb2 ](field_mask_pb2.html)
  * [ google.protobuf.internal.containers ](internal/containers.html)
  * [ google.protobuf.json_format ](json_format.html)
  * google.protobuf.message 
  * [ google.protobuf.message_factory ](message_factory.html)
  * [ google.protobuf.proto_builder ](proto_builder.html)
  * [ google.protobuf.reflection ](reflection.html)
  * [ google.protobuf.service ](service.html)
  * [ google.protobuf.service_reflection ](service_reflection.html)
  * [ google.protobuf.struct_pb2 ](struct_pb2.html)
  * [ google.protobuf.symbol_database ](symbol_database.html)
  * [ google.protobuf.text_encoding ](text_encoding.html)
  * [ google.protobuf.text_format ](text_format.html)
  * [ google.protobuf.timestamp_pb2 ](timestamp_pb2.html)
  * [ google.protobuf.type_pb2 ](type_pb2.html)
  * [ google.protobuf.unknown_fields ](unknown_fields.html)
  * [ google.protobuf.wrappers_pb2 ](wrappers_pb2.html)

###  Related Topics

  * [ Documentation overview ](../../index.html)
    * Previous: [ google.protobuf.json_format ](json_format.html "previous chapter")
    * Next: [ google.protobuf.message_factory ](message_factory.html "next chapter")

###  This Page

  * [ Show