'Args:
origin:
event:
state:
auth_events:
Returns:
Deferred, which resolves to synapse.events.snapshot.EventContext'

@defer.inlineCallbacks
def _prep_event(self, origin, event, state=None, auth_events=None):

    context = (yield self.state_handler.compute_event_context(event, old_state=state))
    if (not auth_events):
        auth_events_ids = (yield self.auth.compute_auth_events(event, context.prev_state_ids, for_verification=True))
        auth_events = (yield self.store.get_events(auth_events_ids))
        auth_events = {(e.type, e.state_key): e for e in auth_events.values()}
    if ((event.type == EventTypes.Member) and (not event.auth_events)):
        if ((len(event.prev_events) == 1) and (event.depth < 5)):
            c = (yield self.store.get_event(event.prev_events[0][0], allow_none=True))
            if (c and (c.type == EventTypes.Create)):
                auth_events[(c.type, c.state_key)] = c
    try:
        (yield self.do_auth(origin, event, context, auth_events=auth_events))
    except AuthError as e:
        logger.warn('Rejecting    %s    because    %s', event.event_id, e.msg)
        context.rejected = RejectedReason.AUTH_ERROR
    if (event.type == EventTypes.GuestAccess):
        (yield self.maybe_kick_guest_users(event))
    defer.returnValue(context)
