from typing import Union
from typing import Dict
from typing import Any
from typing import MutableMapping
from typing import List
from typing import Set


def delete_keys_from_dict(
    dictionary: Union[Dict[Any, Any], MutableMapping], keys: Union[str, List[str], Set[str]]  # type: ignore
) -> Dict[Any, Any]:
    """
    Removing key/value pairs from dictionary. Works for nested dicts as well.

    :param dictionary: A input dictionary
    :param keys: A single or list of keys
    :return: The modified dictionary with listed keys removed
    """

    if isinstance(keys, str):
        keys = [keys]
    keys_set = set(keys)

    modified_dict = {}
    for key, value in dictionary.items():
        if key not in keys_set:
            if isinstance(value, MutableMapping):
                modified_dict[key] = delete_keys_from_dict(value, keys_set)
            elif isinstance(value, list):
                modified_dict[key] = []  # type: ignore
                for el in value:
                    if isinstance(el, MutableMapping):
                        modified_dict[key].append(delete_keys_from_dict(el, keys_set))  # type: ignore
                    else:
                        modified_dict[key].append(el)  # type: ignore
            else:
                modified_dict[key] = value
    return modified_dict