'Execute a Qtile command using the client syntax
Tab completeion aids navigation of the command tree
Parameters
prompt :
Text to display at the prompt (default: "command: ")
widget :
Name of the prompt widget (default: "prompt")
messenger :
Command to display output, set this to None to disable (default:
"xmessage")'

def cmd_qtilecmd(self, prompt='command', widget='prompt', messenger='xmessage'):

    def f(cmd):
        if cmd:
            c = command.CommandRoot(self)
            try:
                cmd_arg = str(cmd).split('    ')
            except AttributeError:
                return
            cmd_len = len(cmd_arg)
            if (cmd_len == 0):
                logger.info('No    command    entered.')
                return
            try:
                result = eval(u'c.{0:s}'.format(cmd))
            except (command.CommandError, command.CommandException, AttributeError) as err:
                logger.error(err)
                result = None
            if (result is not None):
                from pprint import pformat
                message = pformat(result)
                if messenger:
                    self.cmd_spawn('{0:s}    "{1:s}"'.format(messenger, message))
                logger.info(result)
    mb = self.widgetMap[widget]
    if (not mb):
        logger.error('No    widget    named    {0:s}    present.'.format(widget))
        return
    mb.startInput(prompt, f, 'qshell')
