def delete_keys_from_dict(dict_del, the_keys):
    """
    Delete the keys present in the lst_keys from the dictionary.
    Loops recursively over nested dictionaries.
    """
if type(the_keys) is not set:
    the_keys = set(the_keys)
for k, v in list(dict_del.items()):
    if k in the_keys:
        del dict_del[k]
if isinstance(v, dict):
    delete_keys_from_dict(v, the_keys)
return dict_del
Элегантный способ удаления полей из вложенных словарей