code: def end_grouping(self):
          
          close = self._open.pop()
          if not close:
              return
          if self._open:
              self._open[-1].extend(close)
          elif self._undoing:
              self._redo.append(close)
          else:
              self._undo.append(close)
          self.notify()
docs: Raises IndexError when no group is open.