def _re_hl(tweet, re_name):

    words = []
    colors = Term.colors()
    patterns = Term.patterns()
    last_match = 0
    for match in re.finditer(patterns[re_name], tweet):
        span = match.span()
        bump = int(span[0] != 0) and re_name != "url"
        words.append(tweet[last_match:span[0] + bump])
        word = "{0}{1}{2}".format(
            colors[re_name],
            tweet[span[0] + bump:span[1]],
            colors["text"],
        )
        words.append(word)
        last_match = span[1]

    words.append(tweet[last_match:])
    return "".join(words)
Highlights the tweet with the color and pattern of name.
dataset/ETHPy150Open a-tal/pyweet/pyweet/colors.py/_re_hl