def METHOD_NAME(txt):
    res = ''
    i = 0
    name = ''
    while i<len(txt):
        car = txt[i]
        if car in ["'",'"']:
            k = i+1
            while k<len(txt):
                if txt[k]==car:
                    res += html.SPAN(txt[i:k+1],Class='string')
                    i = k
                    break
                k += 1
        elif car == '#': # comment
            res += html.SPAN(txt[i:],Class='comment')
            break
        elif car in string.ascii_letters+'_':
            name += car
        elif car in string.digits and name:
            name += car
        else:
            if name:
                if re.search(kw_pattern,name):
                    res += html.SPAN(name,Class='keyword')
                elif re.search(bf_pattern,name):
                    res += html.SPAN(name,Class='keyword')
                else:
                    res += name
                name = ''
            res += car
        i += 1
    res += name
    return res