Return only keys that meet the test
    :param d: Dictionary
    :param test: the test to run on the value (example override is: "lambda v: v is not None")
    :return: Cleaned dictionary

def clean_dict(d, test=lambda v: v):
    """
    Return only keys that meet the test
    :param d: Dictionary
    :param test: the test to run on the value (example override is: "lambda v: v is not None")
    :return: Cleaned dictionary
    """
    return {k: v for k, v in d.items() if test(v)}