def _next_partition(self, topic):
        if self.partition_cycles not in topic:
            if not self.client.has_metadata_for_topic(topic):
                self.client.ensure_topic_exists(topic)

            self.partition_cycles[topic] = cycle(self.client.get_partition_ids_for_topic(topic))

            # Randomize the initial partition that is returned
            if self.random_start:
                num_partitions = len(self.client.get_partition_ids_for_topic(topic))
                for _ in xrange(random.randint(0, num_partitions-1)):
                    next(self.partition_cycles[topic])

        return next(self.partition_cycles[topic])
dataset/ETHPy150Open dpkp/kafka-python/kafka/producer/simple.py/SimpleProducer._next_partition/swapped operands of `not in`