def _do_debug(self, cmd, args):
        """\
        Enter the debugging shell.
            debug               Show current debugging status, i.e, on/off.
            debug {on,off}      Turn on/off debugging info.
            debug shell         Enter debugging shell.
            debug toggle        Toggle current debugging status.
        """
        if not args:
            self.stdout.write('on' if self.debug else 'off')
            self.stdout.write('\n')
            return
        if len(args) > 1:
            self.stderr.write('debug: too many arguments: {}\n'.format(args))
            return
        action = args[0]
        if action == 'on':
            self.debug = True
        elif action == 'off':
            self.debug = False
        elif action == 'shell':
            return 'DEBUG'
        elif action == 'toggle':
            self.debug = not self.debug
            self.stdout.write('on' if self.debug else 'off')
            self.stdout.write('\n')
        else:
            self.stderr.write('debug: unrecognized argument: {}\n'.format(action))
\
        Enter the debugging shell.
            debug               Show current debugging status, i.e, on/off.
            debug {on,off}      Turn on/off debugging info.
            debug shell         Enter debugging shell.
            debug toggle        Toggle current debugging status.