def METHOD_NAME(text, attribute):
    if isinstance(text, str):
        return "{start}{txt}{stop}".format(start=TEXT_CODES[attribute]['start'],
                                           txt=text,
                                           stop=TEXT_CODES[attribute]['end'])
    elif isinstance(text, unicode):
        return u"{start}{txt}{stop}".format(start=TEXT_CODES[attribute]['start'],
                                            txt=text,
                                            stop=TEXT_CODES[attribute]['end'])
    else:
        raise Exception("not a string")