def get_media_entities(tweet):
    """
    Grabs all the media entities from a tweet, which are contained in the
    "extended_entities" or "twitter_extended_entities" field depending on the
    tweet format. Note that this is not the same as the first media entity from
    the basic `entities` key; this is required to get *all* of the potential
    media contained within a tweet. This is useful as an entry point for other
    functions or for any custom parsing that needs to be done.

    Args:
        tweet (Tweet or dict): the tweet in question

    Returns:
        list or None: the list of dicts containing each media's metadata in the
        tweet.

    Example:
        >>> from tweet_parser.getter_methods.tweet_entities import get_media_entities
        >>> tweet = {'created_at': '2017-21-23T15:21:21.000Z',
        ...          'entities': {'user_mentions': [{'id': 2382763597,
        ...          'id_str': '2382763597',
        ...          'indices': [14, 26],
        ...          'name': 'Fiona',
        ...          'screen_name': 'notFromShrek'}]},
        ...          'extended_entities': {'media': [{'display_url': 'pic.twitter.com/something',
        ...          'expanded_url': 'https://twitter.com/something',
        ...          'id': 4242,
        ...          'id_str': '4242',
        ...          'indices': [88, 111],
        ...          'media_url': 'http://pbs.twimg.com/media/something.jpg',
        ...          'media_url_https': 'https://pbs.twimg.com/media/something.jpg',
        ...          'sizes': {'large': {'h': 1065, 'resize': 'fit', 'w': 1600},
        ...          'medium': {'h': 799, 'resize': 'fit', 'w': 1200},
        ...          'small': {'h': 453, 'resize': 'fit', 'w': 680},
        ...          'thumb': {'h': 150, 'resize': 'crop', 'w': 150}},
        ...          'type': 'photo',
        ...          'url': 'https://t.co/something'},
        ...          {'display_url': 'pic.twitter.com/something_else',
        ...          'expanded_url': 'https://twitter.com/user/status/something/photo/1',
        ...          'id': 4243,
        ...          'id_str': '4243',
        ...          'indices': [88, 111],
        ...          'media_url': 'http://pbs.twimg.com/media/something_else.jpg',
        ...          'media_url_https': 'https://pbs.twimg.com/media/something_else.jpg',
        ...          'sizes': {'large': {'h': 1065, 'resize': 'fit', 'w': 1600},
        ...          'medium': {'h': 799, 'resize': 'fit', 'w': 1200},
        ...          'small': {'h': 453, 'resize': 'fit', 'w': 680},
        ...          'thumb': {'h': 150, 'resize': 'crop', 'w': 150}},
        ...          'type': 'photo',
        ...          'url': 'https://t.co/something_else'}]}
        ...         }
        >>> get_media_entities(tweet)
        [{'display_url': 'pic.twitter.com/something', 'expanded_url': 'https://twitter.com/something', 'id': 4242, 'id_str': '4242', 'indices': [88, 111], 'media_url': 'http://pbs.twimg.com/media/something.jpg', 'media_url_https': 'https://pbs.twimg.com/media/something.jpg', 'sizes': {'large': {'h': 1065, 'resize': 'fit', 'w': 1600}, 'medium': {'h': 799, 'resize': 'fit', 'w': 1200}, 'small': {'h': 453, 'resize': 'fit', 'w': 680}, 'thumb': {'h': 150, 'resize': 'crop', 'w': 150}}, 'type': 'photo', 'url': 'https://t.co/something'}, {'display_url': 'pic.twitter.com/something_else', 'expanded_url': 'https://twitter.com/user/status/something/photo/1', 'id': 4243, 'id_str': '4243', 'indices': [88, 111], 'media_url': 'http://pbs.twimg.com/media/something_else.jpg', 'media_url_https': 'https://pbs.twimg.com/media/something_else.jpg', 'sizes': {'large': {'h': 1065, 'resize': 'fit', 'w': 1600}, 'medium': {'h': 799, 'resize': 'fit', 'w': 1200}, 'small': {'h': 453, 'resize': 'fit', 'w': 680}, 'thumb': {'h': 150, 'resize': 'crop', 'w': 150}}, 'type': 'photo', 'url': 'https://t.co/something_else'}]
    """

    ext_ents_key = "extended_entities" if is_original_format(tweet) else "twitter_extended_entities"
    ext_ents = tweet.get(ext_ents_key)
    media = ext_ents.get("media", []) if ext_ents else []
    return media