def filter_realms(realms, filter_dict):
    """Takes a list of realms and returns the subset of that list that meets the filter_dict's criteria."""
    filter_function = lambda realm: \
        ("id" not in filter_dict or filter_dict["id"] == realm.id)
    return filter(filter_function, realms)
dataset/ETHPy150Open bmbouter/Opus/opus/lib/prov/drivers/driver_tools.py/filter_realms/original