'Get receipts for multiple rooms for sending to clients.
Args:
room_ids (list): List of room_ids.
to_key (int): Max stream id to fetch receipts upto.
from_key (int): Min stream id to fetch receipts from. None fetches
from the start.
Returns:
list: A list of receipts.'

@defer.inlineCallbacks
def get_linearized_receipts_for_rooms(self, room_ids, to_key, from_key=None):

    room_ids = set(room_ids)
    if from_key:
        room_ids = (yield self._receipts_stream_cache.get_entities_changed(room_ids, from_key))
    results = (yield self._get_linearized_receipts_for_rooms(room_ids, to_key, from_key=from_key))
    defer.returnValue([ev for res in results.values() for ev in res])
