Check commit counter and do a commit if need be

def _do_write(self):
        """
        Check commit counter and do a commit if need be
        """
        with self.lock:
            self._commit_counter += 1
            if self._commit_counter >= self._commit_every:
                self._db.commit()
                self._commit_counter = 0