'Get all the client account_data for a that\'s changed for a user
Args:
user_id(str): The user to get the account_data for.
stream_id(int): The point in the stream since which to get updates
Returns:
A deferred pair of a dict of global account_data and a dict
mapping from room_id string to per room account_data dicts.'

def get_updated_account_data_for_user(self, user_id, stream_id):

    def get_updated_account_data_for_user_txn(txn):
        sql = 'SELECT    account_data_type,    content    FROM    account_data    WHERE    user_id    =    ?    AND    stream_id    >    ?'
        txn.execute(sql, (user_id, stream_id))
        global_account_data = {row[0]: json.loads(row[1]) for row in txn}
        sql = 'SELECT    room_id,    account_data_type,    content    FROM    room_account_data    WHERE    user_id    =    ?    AND    stream_id    >    ?'
        txn.execute(sql, (user_id, stream_id))
        account_data_by_room = {}
        for row in txn:
            room_account_data = account_data_by_room.setdefault(row[0], {})
            room_account_data[row[1]] = json.loads(row[2])
        return (global_account_data, account_data_by_room)
    changed = self._account_data_stream_cache.has_entity_changed(user_id, int(stream_id))
    if (not changed):
        return ({}, {})
    return self.runInteraction('get_updated_account_data_for_user', get_updated_account_data_for_user_txn)
