def recursive_dict_removal(inventory, purge_list):
 for (key, value) in inventory.iteritems():
  if isinstance(value, dict):
   for (child_key, child_value) in value.iteritems():
    if isinstance(child_value, dict):
     for item in purge_list:
      if (item in child_value):
       del child_value[item]
    elif isinstance(child_value, list):
     recursive_list_removal(child_value, purge_list)
  elif isinstance(value, list):
   recursive_list_removal(value, purge_list)

def recursive_dict_removal ( inventory , purge_list ) : for ( key , value ) in inventory . iteritems ( ) : if isinstance ( value , dict ) : for ( child_key , child_value ) in value . iteritems ( ) : if isinstance ( child_value , dict ) : for item in purge_list : if ( item in child_value ) : del child_value [ item ] elif isinstance ( child_value , list ) : recursive_list_removal ( child_value , purge_list ) elif isinstance ( value , list ) : recursive_list_removal ( value , purge_list )
remove items from a dictionary .