from typing import Hashable
from typing import Any


def safeget(dct: dict, *keys: Hashable) -> Any:
    """ Safely get value from a nested dict; like Hash#dig in Ruby.
        See: https://stackoverflow.com/questions/25833613/python-safe-method-to-get-value-of-nested-dictionary
    """
    if type(dct) is not dict:
        return None
    for key in keys:
        try:
            dct = dct[key]
        except KeyError:
            return None
    return dct