'Args:
event (EventBase):
context (EventContext):
backfilled (bool):
Returns:
Deferred: resolves to (int, int): the stream ordering of ``event``,
and the stream ordering of the latest persisted event'

@defer.inlineCallbacks
@log_function
def persist_event(self, event, context, backfilled=False):

    deferred = self._event_persist_queue.add_to_queue(event.room_id, [(event, context)], backfilled=backfilled)
    self._maybe_start_persisting(event.room_id)
    (yield preserve_context_over_deferred(deferred))
    max_persisted_id = (yield self._stream_id_gen.get_current_token())
    defer.returnValue((event.internal_metadata.stream_ordering, max_persisted_id))
