#NEWLINE# def recursive_dict_removal( inventory , purge_list ) : #NEWLINE# #INDENT# 'Remove items from a dictionary.\n\n    Keyword arguments:\n    inventory -- inventory dictionary\n    purge_list -- list of items to remove\n    ' #NEWLINE# for ( key , value ) in inventory . iteritems ( ) : #NEWLINE# #INDENT# if isinstance ( value , dict ) : #NEWLINE# #INDENT# for ( _key , _value ) in value . iteritems ( ) : #NEWLINE# #INDENT# if isinstance ( _value , dict ) : #NEWLINE# #INDENT# for item in purge_list : #NEWLINE# #INDENT# if ( item in _value ) : #NEWLINE# #INDENT# del _value [ item ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( _value , list ) : #NEWLINE# #INDENT# recursive_list_removal ( _value , purge_list ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( value , list ) : #NEWLINE# #INDENT# recursive_list_removal ( value , purge_list )