def contains_link(tweet):
    """Returns true if tweet contains link (URL or Media). Checks entities"""
    if 'entities' not in tweet:
        return False
    if 'urls' in tweet['entities']:
        if len(tweet['entities']['urls']) > 0:
            return True
    if 'media' in tweet['entities']:
        if len(tweet['entities']['media']) > 0:
            return True
    return False
