<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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