'Tweet a message, optionally with media.'

def send_message(self, message='', **kwargs):

    data = kwargs.get(ATTR_DATA)
    media = None
    if data:
        media = data.get(ATTR_MEDIA)
        if (not self.hass.config.is_allowed_path(media)):
            _LOGGER.warning("'%s'    is    not    a    whitelisted    directory", media)
            return
    media_id = self.upload_media(media)
    if self.user:
        resp = self.api.request('direct_messages/new', {'text': message, 'user': self.user, 'media_ids': media_id})
    else:
        resp = self.api.request('statuses/update', {'status': message, 'media_ids': media_id})
    if (resp.status_code != 200):
        self.log_error_resp(resp)
