def prune_nones(mydict):
 return dict([(k, v) for (k, v) in mydict.items() if ((v != None) and (v != 'None'))])

def prune_nones ( mydict ) : return dict ( [ ( k , v ) for ( k , v ) in mydict . items ( ) if ( ( v != None ) and ( v != 'None' ) ) ] )
remove keys from mydict whose values are none :arg mydict: the dictionary to act on :rtype: dict .