def reformat_dict_keys(keymap=None, inputdict=None):
 keymap = (keymap or {})
 inputdict = (inputdict or {})
 return dict([(outk, inputdict[ink]) for (ink, outk) in keymap.items() if (ink in inputdict)])

def reformat_dict_keys ( keymap = None , inputdict = None ) : keymap = ( keymap or { } ) inputdict = ( inputdict or { } ) return dict ( [ ( outk , inputdict [ ink ] ) for ( ink , outk ) in keymap . items ( ) if ( ink in inputdict ) ] )
utility function for mapping one dict format to another .