def save(self):
        global curr_transaction_window
        self.validate()
        if not self._errors:
            if not (self.changed or self.new):
                return True
            elif self.batched:
                if self._pending_save:
                    return
                self._cache[self.id] = self
                self._save_list.append(self)
                self._pending_save = True
                if curr_transaction_window >= max_transaction_window:
                    flush()
                    curr_transaction_window = 0
                else:
                    curr_transaction_window += 1
            else:
                raise NotImplementedError('Non batched saves are not supported')
            return True
        else:
            return False
dataset/ETHPy150Open ebroder/anygit/anygit/backends/mongodb.py/MongoDbModel.save/original