def trimDict(aDict, cond=(lambda k,v:1)):
    ''' Return a new dict in which its items whose cond(k,v) == true
    are removed (discarded) from aDict.
    The cond is a function taking 2 arguments: key and value
    
    >>> g
    {'A': 0, 'C': 2, 'B': 1, 'E': 4, 'D': 3}
    >>> trimDict(g, lambda x,y:y%2!=0)
    {'A': 0, 'C': 2, 'E': 4}
    
    '''    
    tmp={}
    [tmp.setdefault(k,v) for k,v in aDict.items() if not cond(k,v)]
    return tmp.copy()
 Return a new dict in which its items whose cond(k,v) == true
    are removed (discarded) from aDict.
    The cond is a function taking 2 arguments: key and value
    
    >>> g
    {'A': 0, 'C': 2, 'B': 1, 'E': 4, 'D': 3}
    >>> trimDict(g, lambda x,y:y%2!=0)
    {'A': 0, 'C': 2, 'E': 4}
    
    
recipes/Python/278259_Dictionary_Tools/recipe-278259.py