'Assign a custom recog (nick) to the given object.
Args:
obj (Object): The object ot associate with the recog
string. This is usually determined from the sdesc in the
room by a call to parse_sdescs_and_recogs, but can also be
given.
recog (str): The replacement string to use with this object.
max_length (int, optional): The max length of the recog string.
Returns:
recog (str): The (possibly cleaned up) recog string actually set.
Raises:
SdescError: When recog could not be set or sdesc longer
than `max_length`.'

def add(self, obj, recog, max_length=60):

    recog = _RE_REF.sub('\\1', _RE_REF_LANG.sub('\\1', _RE_SELF_REF.sub('', _RE_LANGUAGE.sub('', _RE_OBJ_REF_START.sub('', recog)))))
    cleaned_recog = ansi.strip_ansi(recog)
    if (not cleaned_recog):
        raise SdescError('Recog    string    cannot    be    empty.')
    if (len(cleaned_recog) > max_length):
        raise RecogError(('Recog    string    cannot    be    longer    than    %i    chars    (was    %i    chars)' % (max_length, len(cleaned_recog))))
    key = ('#%i' % obj.id)
    self.obj.attributes.get('_recog_ref2recog', default={})[key] = recog
    self.obj.attributes.get('_recog_obj2recog', default={})[obj] = recog
    regex = ordered_permutation_regex(cleaned_recog)
    self.obj.attributes.get('_recog_obj2regex', default={})[obj] = regex
    self.ref2recog[key] = recog
    self.obj2recog[obj] = recog
    self.obj2regex[obj] = re.compile(regex, _RE_FLAGS)
    return recog
