import re


def expand_contractions(tweet):
    """
    Expands language contractions found in the English vocabulary
    in the tweet.
    INPUT:
        tweet: original tweet as a string
    OUTPUT:
        tweet with its contractions expanded
    """
    tweet = re.sub("can't", 'cannot', tweet, flags=re.I)
    #tweet = re.sub("cant", 'can\'t', tweet, flags=re.I)
    tweet = re.sub("won't", 'will not', tweet, flags=re.I)
    #tweet = re.sub("wont", 'won\'t', tweet, flags=re.I)
    tweet = re.sub("n't", ' not', tweet, flags=re.I)
    tweet = re.sub("i'm", 'i am', tweet, flags=re.I)
    #tweet = re.sub("im", 'i am', tweet, flags=re.I)
    tweet = re.sub("'re", ' are', tweet, flags=re.I)
    tweet = re.sub("it's", 'it is', tweet, flags=re.I)    
    tweet = re.sub("that's", 'that is', tweet, flags=re.I)
    tweet = re.sub("'ll", ' will', tweet, flags=re.I)
    tweet = re.sub("'l", ' will', tweet, flags=re.I)
    tweet = re.sub("'ve", ' have', tweet, flags=re.I)
    tweet = re.sub("'d", ' would', tweet, flags=re.I)
    tweet = re.sub("he's", 'he is', tweet, flags=re.I)
    tweet = re.sub("she's", 'she is', tweet, flags=re.I)
    tweet = re.sub("what's", 'what is', tweet, flags=re.I)
    tweet = re.sub("who's", 'who is', tweet, flags=re.I)
    tweet = re.sub("'s", '', tweet, flags=re.I)
    tweet = re.sub("\'em", ' \'em', tweet, flags=re.I)
    return tweet