code: def GroupEncoder(field_number, is_repeated, is_packed):
      """Returns an encoder for a group field."""
  
      start_tag = TagBytes(
          field_number, wire_format.WIRETYPE_START_GROUP
      )
      end_tag = TagBytes(field_number, wire_format.WIRETYPE_END_GROUP)
      assert not is_packed
      if is_repeated:
  
          def EncodeRepeatedField(write, value):
              for element in value:
                  write(start_tag)
                  element._InternalSerialize(write)
                  write(end_tag)
  
          return EncodeRepeatedField
      else:
  
          def EncodeField(write, value):
              write(start_tag)
              value._InternalSerialize(write)
              return write(end_tag)
  
          return EncodeField
  
imports: import struct
  import six
  from google.protobuf.internal import wire_format
label_desc: Use image node_id 24 for calling a global function with example usage: GroupEncoder(field_number, is_repeated, is_packed) and returns: EncodeRepeatedField, EncodeField, write