'Assign the recog'

def func(self):

    caller = self.caller
    if (not self.args):
        caller.msg('Usage:    recog    <sdesc>    as    <alias>    or    forget    <alias>')
        return
    sdesc = self.sdesc
    alias = self.alias.rstrip('.?!')
    prefixed_sdesc = (sdesc if sdesc.startswith(_PREFIX) else (_PREFIX + sdesc))
    candidates = caller.location.contents
    matches = parse_sdescs_and_recogs(caller, candidates, prefixed_sdesc, search_mode=True)
    nmatches = len(matches)
    if (nmatches == 0):
        caller.msg(_EMOTE_NOMATCH_ERROR.format(ref=sdesc))
    elif (nmatches > 1):
        reflist = [('%s%s%s    (%s%s)' % ((inum + 1), _NUM_SEP, _RE_PREFIX.sub('', sdesc), caller.recog.get(obj), (('    (%s)' % caller.key) if (caller == obj) else ''))) for (inum, obj) in enumerate(matches)]
        caller.msg(_EMOTE_MULTIMATCH_ERROR.format(ref=sdesc, reflist='\n                '.join(reflist)))
    else:
        obj = matches[0]
        if (not obj.access(self.obj, 'enable_recog', default=True)):
            caller.msg("Can't    recognize    someone    who    is    masked.")
            return
        if (self.cmdstring == 'forget'):
            caller.recog.remove(obj)
            caller.msg(("%s    will    now    know    only    '%s'." % (caller.key, obj.recog.get(obj))))
        else:
            sdesc = (obj.sdesc.get() if hasattr(obj, 'sdesc') else obj.key)
            try:
                alias = caller.recog.add(obj, alias)
            except RecogError as err:
                caller.msg(err)
                return
            caller.msg(('%s    will    now    remember    |w%s|n    as    |w%s|n.' % (caller.key, sdesc, alias)))
