@classmethod<EOL><INDENT>def encode_metadata_request(cls, client_id, correlation_id, topics=None,<EOL>payloads=None):<DEDENT>
if payloads is None:<EOL><INDENT>topics = [] if topics is None else topics<EOL><DEDENT>else:<EOL><INDENT>topics = payloads<EOL><DEDENT>message = []<EOL>message.append(cls._encode_message_header(client_id, correlation_id,<EOL>KafkaProtocol.METADATA_KEY))<EOL>message.append(struct.pack('<STR_LIT>', len(topics)))<EOL>for topic in topics:<EOL><INDENT>message.append(struct.pack('<STR_LIT>' % len(topic), len(topic), topic))<EOL><DEDENT>msg = b'<STR_LIT>'.join(message)<EOL>return write_int_string(msg)<EOL>
Encode a MetadataRequest

Arguments:
    client_id: string
    correlation_id: int
    topics: list of strings