<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def undo_nested_group(self):
 """ Performs the last group opened, or the top group on the undo stack. Creates a redo group with the same name. """

        if self._undoing or self._redoing:
            raise RuntimeError
        if self._open:
            group = self._open.pop()
        elif self._undo:
            group = self._undo.pop()
        else:
            return

        self._undoing = True

        self.begin_grouping()
        group.perform()
        self.set_action_name(group.name)
        self.end_grouping()

        self._undoing = False

        self.notify()