'Get the room state at a particular stream position
Args:
room_id(str): room for which to get state
stream_position(StreamToken): point at which to get state
Returns:
A Deferred map from ((type, state_key)->Event)'

@defer.inlineCallbacks
def get_state_at(self, room_id, stream_position):

    (last_events, token) = (yield self.store.get_recent_events_for_room(room_id, end_token=stream_position.room_key, limit=1))
    if last_events:
        last_event = last_events[(-1)]
        state = (yield self.get_state_after_event(last_event))
    else:
        state = {}
    defer.returnValue(state)
