def commit(self, partitions=None):
<EOL>if self.count_since_commit == <NUM_LIT:0>:<EOL><INDENT>return<EOL><DEDENT>with self.commit_lock:<EOL><INDENT>if self.count_since_commit == <NUM_LIT:0>:<EOL><INDENT>return<EOL><DEDENT>reqs = []<EOL>if partitions is None:  <EOL><INDENT>partitions = list(self.offsets.keys())<EOL><DEDENT>log.debug('<STR_LIT>',<EOL>self.topic, partitions)<EOL>for partition in partitions:<EOL><INDENT>offset = self.offsets[partition]<EOL>log.debug('<STR_LIT>'<EOL>'<STR_LIT>',<EOL>offset, self.group, self.topic, partition)<EOL>reqs.append(OffsetCommitRequest(self.topic, partition,<EOL>offset, None))<EOL><DEDENT>try:<EOL><INDENT>self.client.send_offset_commit_request(self.group, reqs)<EOL><DEDENT>except KafkaError as e:<EOL><INDENT>log.error('<STR_LIT>', e.__class__.__name__, e)<EOL>return False<EOL><DEDENT>else:<EOL><INDENT>self.count_since_commit = <NUM_LIT:0><EOL>return True<EOL><DEDENT><DEDENT>
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