'Requests all of the `current` state PDUs for a given room from
a remote home server.
Args:
destination (str): The remote homeserver to query for the state.
room_id (str): The id of the room we\'re interested in.
event_id (str): The id of the event we want the state at.
Returns:
Deferred: Results in a list of PDUs.'

@defer.inlineCallbacks
@log_function
def get_state_for_room(self, destination, room_id, event_id):

    try:
        result = (yield self.transport_layer.get_room_state_ids(destination, room_id, event_id=event_id))
        state_event_ids = result['pdu_ids']
        auth_event_ids = result.get('auth_chain_ids', [])
        (fetched_events, failed_to_fetch) = (yield self.get_events([destination], room_id, set((state_event_ids + auth_event_ids))))
        if failed_to_fetch:
            logger.warn('Failed    to    get    %r', failed_to_fetch)
        event_map = {ev.event_id: ev for ev in fetched_events}
        pdus = [event_map[e_id] for e_id in state_event_ids if (e_id in event_map)]
        auth_chain = [event_map[e_id] for e_id in auth_event_ids if (e_id in event_map)]
        auth_chain.sort(key=(lambda e: e.depth))
        defer.returnValue((pdus, auth_chain))
    except HttpResponseException as e:
        if ((e.code == 400) or (e.code == 404)):
            logger.info('Failed    to    use    get_room_state_ids    API,    falling    back')
        else:
            raise e
    result = (yield self.transport_layer.get_room_state(destination, room_id, event_id=event_id))
    pdus = [self.event_from_pdu_json(p, outlier=True) for p in result['pdus']]
    auth_chain = [self.event_from_pdu_json(p, outlier=True) for p in result.get('auth_chain', [])]
    seen_events = (yield self.store.get_events([ev.event_id for ev in itertools.chain(pdus, auth_chain)]))
    signed_pdus = (yield self._check_sigs_and_hash_and_fetch(destination, [p for p in pdus if (p.event_id not in seen_events)], outlier=True))
    signed_pdus.extend((seen_events[p.event_id] for p in pdus if (p.event_id in seen_events)))
    signed_auth = (yield self._check_sigs_and_hash_and_fetch(destination, [p for p in auth_chain if (p.event_id not in seen_events)], outlier=True))
    signed_auth.extend((seen_events[p.event_id] for p in auth_chain if (p.event_id in seen_events)))
    signed_auth.sort(key=(lambda e: e.depth))
    defer.returnValue((signed_pdus, signed_auth))
