def _auto_commit(self):
<EOL>if not self.auto_commit or self.auto_commit_every_n is None:<EOL><INDENT>return<EOL><DEDENT>if self.count_since_commit >= self.auto_commit_every_n:<EOL><INDENT>self.commit()<EOL><DEDENT>
Check if we have to commit based on number of messages and commit