def remove_entities_from_text(tweet, text=None, remove_hashtags=True,
    remove_mentions=True):
    """
    Removes all entity text from tweets using entity indices, not text matching.
    Note: 'text' parameter must match indices of tweet entities (ie, text should be 
    either the full tweet text OR a substring starting at the beginning of
    the original tweet text OR a substring padded by arbitrary characters so that
    the indices of the substring align with the original tweet text)
    """
    if 'entities' not in tweet:
        return tweet['text']
    if text:
        text_list = list(text)
    else:
        text_list = list(tweet['text'])
    if 'urls' in tweet['entities']:
        for u in tweet['entities']['urls']:
            l_index, r_index = u['indices'][0], u['indices'][1]
            text_list[l_index:r_index] = [None] * (r_index - l_index)
    if 'media' in tweet['entities']:
        for m in tweet['entities']['media']:
            l_index, r_index = m['indices'][0], m['indices'][1]
            text_list[l_index:r_index] = [None] * (r_index - l_index)
    if 'symbols' in tweet['entities']:
        for s in tweet['entities']['symbols']:
            l_index, r_index = s['indices'][0], s['indices'][1]
            text_list[l_index:r_index] = [None] * (r_index - l_index)
    if remove_hashtags and 'hashtags' in tweet['entities']:
        for h in tweet['entities']['hashtags']:
            l_index, r_index = h['indices'][0], h['indices'][1]
            text_list[l_index:r_index] = [None] * (r_index - l_index)
    if remove_mentions and 'user_mentions' in tweet['entities']:
        for um in tweet['entities']['user_mentions']:
            l_index, r_index = um['indices'][0], um['indices'][1]
            text_list[l_index:r_index] = [None] * (r_index - l_index)
    text_list = filter(None, text_list)
    return ''.join(text_list)
