'Process command'

def func(self):

    caller = self.caller
    def get_cmdset_callback(cmdset):
        '\n                                                We    make    use    of    the    cmdhandeler.get_and_merge_cmdsets    below.    This\n                                                is    an    asynchronous    function,    returning    a    Twisted    deferred.\n                                                So    in    order    to    properly    use    this    we    need    use    this    callback;\n                                                it    is    called    with    the    result    of    get_and_merge_cmdsets,    whenever\n                                                that    function    finishes.    Taking    the    resulting    cmdset,    we    continue\n                                                to    format    and    output    the    result.\n                                                '
        string = self.format_output(obj, cmdset)
        self.msg(string.strip())
    if (not self.args):
        if hasattr(caller, 'location'):
            obj = caller.location
            if (not obj.access(caller, 'examine')):
                self.msg(caller.at_look(obj))
                return
            get_and_merge_cmdsets(obj, self.session, self.player, obj, 'object', self.raw_string).addCallback(get_cmdset_callback)
        else:
            self.msg('You    need    to    supply    a    target    to    examine.')
        return
    for objdef in self.lhs_objattr:
        obj = None
        obj_name = objdef['name']
        obj_attrs = objdef['attrs']
        self.player_mode = (utils.inherits_from(caller, 'evennia.players.players.DefaultPlayer') or ('player' in self.switches) or obj_name.startswith('*'))
        if self.player_mode:
            try:
                obj = caller.search_player(obj_name.lstrip('*'))
            except AttributeError:
                obj = caller.search(obj_name.lstrip('*'), search_object=('object' in self.switches))
        else:
            obj = caller.search(obj_name)
        if (not obj):
            continue
        if (not obj.access(caller, 'examine')):
            self.msg(caller.at_look(obj))
            continue
        if obj_attrs:
            for attrname in obj_attrs:
                caller.msg(self.format_attributes(obj, attrname, crop=False))
        else:
            if obj.sessions.count():
                mergemode = 'session'
            elif self.player_mode:
                mergemode = 'player'
            else:
                mergemode = 'object'
            get_and_merge_cmdsets(obj, self.session, self.player, obj, mergemode, self.raw_string).addCallback(get_cmdset_callback)
