def handle_messages(self, messages_by_partition):
    for (topic_partition, messages) in messages_by_partition.items():
        for message in messages:
            self.handle_message(topic_partition, message)
def handle_messages(self, messages_by_partition):
    for (topic_partition, messages) in messages_by_partition.items():
        for message in messages:
            self.handle_message(topic_partition, message)