\
        Exit shell.
            exit | C-D          Exit to the parent shell.
            exit root | end     Exit to the root shell.
            exit all            Exit to the command line.

def _do_exit(self, cmd, args):
        """\
        Exit shell.
            exit | C-D          Exit to the parent shell.
            exit root | end     Exit to the root shell.
            exit all            Exit to the command line.
        """
        if cmd == 'end':
            if not args:
                return 'root'
            else:
                self.stderr.write(textwrap.dedent('''\
                        end: unrecognized arguments: {}
                        ''')).format(args)

        # Hereafter, cmd == 'exit'.
        if not args:
            return True
        if len(args) > 1:
            self.stderr.write(textwrap.dedent('''\
                    exit: too many arguments: {}
                    ''')).format(args)
        exit_directive = args[0]
        if exit_directive == 'root':
            return 'root'
        if exit_directive == 'all':
            return 'all'
        self.stderr.write(textwrap.dedent('''\
                exit: unrecognized arguments: {}
                ''')).format(args)