docs: def rollback(self, transaction = None):
          """Roll back a transaction."""
          if not self.in_transaction:
              raise NotInTransaction
          for collection, store in self.stores.items():
              store.rollback()
              indexes = self.indexes[collection]
              indexes_to_rebuild = []
              for key, index in indexes.items():
                  try:
                      index.rollback()
                  except NotInTransaction:
                      # this index is "dirty" and needs to be rebuilt
                      # (probably it has been created within a transaction)
                      indexes_to_rebuild.append(key)
              if indexes_to_rebuild:
                  self.rebuild_indexes(collection, indexes_to_rebuild)
          self.in_transaction = False