code: def register(self, func, *args, **kwargs):
          
          self._open[-1].append(UndoOperation(func, *args, **kwargs))
          if not (self._undoing or self._redoing):
              self._redo = []
          self.notify()
docs: Record an undo operation. Also clears the redo stack. Raises IndexError
          when no group is open.