'Commit stored offsets to Kafka via OffsetCommitRequest (v0)
Keyword Arguments:
partitions (list): list of partitions to commit, default is to commit
all of them
Returns: True on success, False on failure'

def commit(self, partitions=None):

    if (self.count_since_commit == 0):
        return
    with self.commit_lock:
        if (self.count_since_commit == 0):
            return
        reqs = []
        if (partitions is None):
            partitions = list(self.offsets.keys())
        log.debug('Committing    new    offsets    for    %s,    partitions    %s', self.topic, partitions)
        for partition in partitions:
            offset = self.offsets[partition]
            log.debug('Commit    offset    %d    in    SimpleConsumer:    group=%s,    topic=%s,    partition=%s', offset, self.group, self.topic, partition)
            reqs.append(OffsetCommitRequestPayload(self.topic, partition, offset, None))
        try:
            self.client.send_offset_commit_request(self.group, reqs)
        except KafkaError as e:
            log.error('%s    saving    offsets:    %s', e.__class__.__name__, e)
            return False
        else:
            self.count_since_commit = 0
            return True
