from typing import Sequence
from typing import Any
from functools import reduce
import operator


def get_from_nested_dict(
    nested_dict: dict,
    location: Sequence,
) -> Any:
    """
    Get a value from a nested dictionary at a given ``location``,
    described by a sequence of keys.

    Example:
        >>> dictionary = {'a': {'b': 42}}
        >>> get_from_nested_dict(dictionary, ['a', 'b'])
        42

    Args:
        nested_dict: A nested dictionary.
        location: The location within the nested dictionary, described
            by a sequence (i.e., a list or tuple) of keys used to access
            the target value.

    Returns:
        The value of the ``nested_dict`` at the specified ``location``.
    """

    return reduce(operator.getitem, location, nested_dict)