code: def encode_offset_fetch_request(cls, client_id, correlation_id,
                                      group, payloads):
          
          grouped_payloads = group_by_topic_and_partition(payloads)
          message = cls._encode_message_header(
              client_id, correlation_id, KafkaCodec.OFFSET_FETCH_KEY,
              api_version=1)
  
          message += write_short_ascii(group)
          message += struct.pack('>i', len(grouped_payloads))
  
          for topic, topic_payloads in grouped_payloads.items():
              message += write_short_ascii(topic)
              message += struct.pack('>i', len(topic_payloads))
  
              for partition in topic_payloads:
                  message += struct.pack('>i', partition)
  
          return message
docs: Encode some OffsetFetchRequest structs
  
          :param bytes client_id: string
          :param int correlation_id: int
          :param bytes group: string, the consumer group you are fetching offsets for
          :param list payloads: list of :class:`OffsetFetchRequest`