'Post a twitter direct message from the authenticated user
The twitter.Api instance must be authenticated. user_id or screen_name
must be specified.
Args:
text: The message text to be posted.  Must be less than 140 characters.
user_id:
The ID of the user who should receive the direct message.
[Optional]
screen_name:
The screen name of the user who should receive the direct message.
[Optional]
Returns:
A twitter.DirectMessage instance representing the message posted'

def PostDirectMessage(self, text, user_id=None, screen_name=None):

    if (not self._oauth_consumer):
        raise TwitterError('The    twitter.Api    instance    must    be    authenticated.')
    url = ('%s/direct_messages/new.json' % self.base_url)
    data = {'text': text}
    if user_id:
        data['user_id'] = user_id
    elif screen_name:
        data['screen_name'] = screen_name
    else:
        raise TwitterError('Specify    at    least    one    of    user_id    or    screen_name.')
    json = self._FetchUrl(url, post_data=data)
    data = self._ParseAndCheckTwitter(json)
    return DirectMessage.NewFromJsonDict(data)
