from typing import Iterable
from typing import Any


def nget(dictionary: dict, keys: Iterable, default: Any = None) -> Any:
    """nget - nested get call to easily retrieve nested information with a single call and set a default
    Ex.
        nget(dict, ['key1', 'key2', ..], default)
        nget(dict, key1, key2, .., default)

        nget use an iterable of keys to retrieve nested information and can set a default if a key is not found
    """
    for key in iter(keys):
        if not isinstance(dictionary, dict):
            raise KeyError(f'About to attempt retrieval of {key} on improper type of {type(dictionary)}')
        if key not in dictionary.keys():
            return default
        dictionary = dictionary[key]
    return dictionary