'Asks a remote server to build and sign us a membership event
Note that this does not append any events to any graphs.
Args:
destination (str): address of remote homeserver
room_id (str): room to join/leave
user_id (str): user to be joined/left
membership (str): one of join/leave
Returns:
Deferred: Succeeds when we get a 2xx HTTP response. The result
will be the decoded JSON body (ie, the new event).
Fails with ``HTTPRequestException`` if we get an HTTP response
code >= 300.
Fails with ``NotRetryingDestination`` if we are not yet ready
to retry this server.'

@defer.inlineCallbacks
@log_function
def make_membership_event(self, destination, room_id, user_id, membership):

    valid_memberships = {Membership.JOIN, Membership.LEAVE}
    if (membership not in valid_memberships):
        raise RuntimeError(("make_membership_event    called    with    membership='%s',    must    be    one    of    %s" % (membership, ','.join(valid_memberships))))
    path = (PREFIX + ('/make_%s/%s/%s' % (membership, room_id, user_id)))
    ignore_backoff = False
    retry_on_dns_fail = False
    if (membership == Membership.LEAVE):
        ignore_backoff = True
        retry_on_dns_fail = True
    content = (yield self.client.get_json(destination=destination, path=path, retry_on_dns_fail=retry_on_dns_fail, timeout=20000, ignore_backoff=ignore_backoff))
    defer.returnValue(content)
