def _removed(time, prev, curr, collected):
    prev_ids = set(res['id'] for res in prev)
    curr_ids = set(res['id'] for res in curr)
    collected_ids = set(res['id'] for res in collected)
    removed_ids = prev_ids - curr_ids
    for res in prev:
        id_val = res['id']
        if id_val in removed_ids:
            # If we already have resource collected only id with removal
            # time will be saved. In case of set of removals current state
            # of removed resource can be restored by data in 'removed',
            # 'added', 'modified'
            if id_val in collected_ids:
                collected.append({'id': id_val, 'time': time.isoformat()})
            else:
                res_data = dict(res, **{'time': time.isoformat()})
                collected.append(res_data)
    return collected
dataset/ETHPy150Open openstack/fuel-web/nailgun/nailgun/statistics/oswl/saver.py/_removed/original