'Post a twitter status message from the user with a picture attached.
Args:
status:
the text of your update
media:
This can be the location of media(PNG, JPG, GIF) on the local file
system or at an HTTP URL, it can also be a file-like object
possibly_sensitive:
set true if content is "advanced." [Optional]
in_reply_to_status_id:
ID of a status that this is in reply to. [Optional]
lat:
latitude of location. [Optional]
long:
longitude of location. [Optional]
place_id:
A place in the world identified by a Twitter place ID. [Optional]
display_coordinates:
Set true if you want to display coordinates. [Optional]
Returns:
A twitter.Status instance representing the message posted.'

def PostMedia(self, status, media, possibly_sensitive=None, in_reply_to_status_id=None, latitude=None, longitude=None, place_id=None, display_coordinates=False):

    warnings.warn("This    endpoint    has    been    deprecated    by    Twitter.    Please    use    PostUpdate()    instead.    Details    of    Twitter's    deprecation    can    be    found    at:    dev.twitter.com/rest/reference/post/statuses/update_with_media", DeprecationWarning)
    url = ('%s/statuses/update_with_media.json' % self.base_url)
    if (isinstance(status, str) or (self._input_encoding is None)):
        u_status = status
    else:
        u_status = str(status, self._input_encoding)
    data = {'status': u_status}
    if (not hasattr(media, 'read')):
        if media.startswith('http'):
            data['media'] = urlopen(media).read()
        else:
            with open(str(media), 'rb') as f:
                data['media'] = f.read()
    else:
        data['media'] = media.read()
    if possibly_sensitive:
        data['possibly_sensitive'] = 'true'
    if in_reply_to_status_id:
        data['in_reply_to_status_id'] = str(in_reply_to_status_id)
    if ((latitude is not None) and (longitude is not None)):
        data['lat'] = str(latitude)
        data['long'] = str(longitude)
    if (place_id is not None):
        data['place_id'] = str(place_id)
    if display_coordinates:
        data['display_coordinates'] = 'true'
    resp = self._RequestUrl(url, 'POST', data=data)
    data = self._ParseAndCheckTwitter(resp.content.decode('utf-8'))
    return Status.NewFromJsonDict(data)
