import re


def replace_tokens(list_of_tokens):
    """
    Per instructions from Fréderic Godin at Ghent University
    links with _URL_, anything with digits to _NUMBER_ and usernames to _MENTION_ 
    """
    for i, token in enumerate(list_of_tokens):
        if ('http:' in token) or ('https:' in token):
            list_of_tokens[i] = '_URL_'
            continue
        if '@' == token[0]:
            list_of_tokens[i] = '_MENTION_'
            continue
        if bool(re.search(r'\d', token)):
            list_of_tokens[i] = '_NUMBER_'
            continue
    return list_of_tokens