'Shared method for Create/Update Friendship.'

def _AddOrEditFriendship(self, user_id=None, screen_name=None, uri_end='create', follow_key='follow', follow=True):

    url = ('%s/friendships/%s.json' % (self.base_url, uri_end))
    data = {}
    if user_id:
        data['user_id'] = user_id
    elif screen_name:
        data['screen_name'] = screen_name
    else:
        raise TwitterError({'message': 'Specify    at    least    one    of    user_id    or    screen_name.'})
    follow_json = json.dumps(follow)
    data['{}'.format(follow_key)] = follow_json
    resp = self._RequestUrl(url, 'POST', data=data)
    data = self._ParseAndCheckTwitter(resp.content.decode('utf-8'))
    return User.NewFromJsonDict(data)
