def recursively_remove_key(obj, key_to_remove):
 if isinstance(obj, list):
  for item in obj:
   recursively_remove_key(item, key_to_remove)
 elif isinstance(obj, dict):
  if (key_to_remove in obj):
   del obj[key_to_remove]
  for (key, unused_value) in obj.items():
   recursively_remove_key(obj[key], key_to_remove)

def recursively_remove_key ( obj , key_to_remove ) : if isinstance ( obj , list ) : for item in obj : recursively_remove_key ( item , key_to_remove ) elif isinstance ( obj , dict ) : if ( key_to_remove in obj ) : del obj [ key_to_remove ] for ( key , unused_value ) in obj . items ( ) : recursively_remove_key ( obj [ key ] , key_to_remove )
recursively removes keys from a list or dict .