def dfilter(fn, record):
    """filter for a directory

    :param fn: A predicate function
    :param record: a dict
    :returns: a dict

    >>> odd = lambda x: x % 2 != 0
    >>> dfilter(odd, {'Terry': 30, 'Graham': 35, 'John': 27})
    {'John': 27, 'Graham': 35}

    """
    return dict([(k, v) for k, v in record.items() if fn(v)])