def save_offsets_for(self, consumer_group, bps_to_next_offsets):
        bp_ids_to_offsets = sorted((bp.id, offset) 
                                   for bp, offset in bps_to_next_offsets.items())
        log.debug("Saving offsets {0}".format(bp_ids_to_offsets))
        for bp, next_offset in sorted(bps_to_next_offsets.items()):
            # The topic might not exist at all, in which case no broker has 
            # anything, so there's no point in making the offsets nodes and such
            if self._zk.exists(self.path_for_topic(bp.topic)):
                offset_path = self.path_for_offset(consumer_group, 
                                                   bp.topic, 
                                                   bp.broker_id,
                                                   bp.partition)
                try:
                    offset_node = self._zk.properties(offset_path)
                except zookeeper.NoNodeException as ex:
                    self._create_path_if_needed(offset_path, bp)
                    offset_node = self._zk.properties(offset_path)
                    next_offset = 0 # If we're creating the node now, assume we
                                    # need to start at 0.                
                # None is the default value when we don't know what the next
                # offset is, possibly because the MessageSet is empty...
                if next_offset is not None:
                    log.debug((offset_node, next_offset) % "Node %s: setting to %s")
                    offset_node.set(string_value=str(next_offset))
dataset/ETHPy150Open DataDog/brod/brod/zk.py/ZKUtil.save_offsets_for/swapped operands of `%`