code: def _rollback(self):
          
  
          # to avoid using self set that may be updated during the process
          indexed_values = set(self._indexed_values)
          deindexed_values = set(self._deindexed_values)
  
          for args in indexed_values:
              self.remove(*args)
          for args in deindexed_values:
              self.add(*args, check_uniqueness=False)
docs: Restore the index in its previous state
  
          This uses values that were indexed/deindexed since the last call
          to `_reset_cache`.
          This is used when an error is encountered while updating a value,
          to return to the previous state