@classmethod<EOL><INDENT>def encode_offset_commit_request(cls, client_id, correlation_id,<EOL>group, payloads):<DEDENT>
grouped_payloads = group_by_topic_and_partition(payloads)<EOL>message = []<EOL>message.append(cls._encode_message_header(client_id, correlation_id,<EOL>KafkaProtocol.OFFSET_COMMIT_KEY))<EOL>message.append(write_short_string(group))<EOL>message.append(struct.pack('<STR_LIT>', len(grouped_payloads)))<EOL>for topic, topic_payloads in grouped_payloads.items():<EOL><INDENT>message.append(write_short_string(topic))<EOL>message.append(struct.pack('<STR_LIT>', len(topic_payloads)))<EOL>for partition, payload in topic_payloads.items():<EOL><INDENT>message.append(struct.pack('<STR_LIT>', partition, payload.offset))<EOL>message.append(write_short_string(payload.metadata))<EOL><DEDENT><DEDENT>msg = b'<STR_LIT>'.join(message)<EOL>return struct.pack('<STR_LIT>' % len(msg), len(msg), msg)<EOL>
Encode some OffsetCommitRequest structs

Arguments:
    client_id: string
    correlation_id: int
    group: string, the consumer group you are committing offsets for
    payloads: list of OffsetCommitRequest