'Persists and notifies local clients and federation of an event.
Args:
event (FrozenEvent) the event to send.
context (Context) the context of the event.
ratelimit (bool): Whether to rate limit this send.
is_guest (bool): Whether the sender is a guest.'

@defer.inlineCallbacks
def send_nonmember_event(self, requester, event, context, ratelimit=True):

    if (event.type == EventTypes.Member):
        raise SynapseError(500, 'Tried    to    send    member    event    through    non-member    codepath')
    (yield self.ratelimit(requester, update=False))
    user = UserID.from_string(event.sender)
    assert self.hs.is_mine(user), ('User    must    be    our    own:    %s' % (user,))
    if event.is_state():
        prev_state = (yield self.deduplicate_state_event(event, context))
        if (prev_state is not None):
            defer.returnValue(prev_state)
    (yield self.handle_new_client_event(requester=requester, event=event, context=context, ratelimit=ratelimit))
    if (event.type == EventTypes.Message):
        presence = self.hs.get_presence_handler()
        preserve_fn(presence.bump_presence_active_time)(user)
