'Retrieves the current state for the room. This is done by
calling `get_latest_events_in_room` to get the leading edges of the
event graph and then resolving any of the state conflicts.
This is equivalent to getting the state of an event that were to send
next before receiving any new events.
If `event_type` is specified, then the method returns only the one
event (or None) with that `event_type` and `state_key`.
Returns:
map from (type, state_key) to event'

@defer.inlineCallbacks
def get_current_state(self, room_id, event_type=None, state_key='', latest_event_ids=None):

    if (not latest_event_ids):
        latest_event_ids = (yield self.store.get_latest_event_ids_in_room(room_id))
    logger.debug('calling    resolve_state_groups    from    get_current_state')
    ret = (yield self.resolve_state_groups(room_id, latest_event_ids))
    state = ret.state
    if event_type:
        event_id = state.get((event_type, state_key))
        event = None
        if event_id:
            event = (yield self.store.get_event(event_id, allow_none=True))
        defer.returnValue(event)
        return
    state_map = (yield self.store.get_events(state.values(), get_prev_content=False))
    state = {key: state_map[e_id] for (key, e_id) in state.items() if (e_id in state_map)}
    defer.returnValue(state)
