def get_nested_value(d: dict, path: dict):
    """
    Retrieves value from nested dictionary
    :param d: {key: {key_2: {key_2_1: hey}, key_1: 1234}
    :param path: {key: {key_2: key_2_1}} path to take through the dictionary d
    :return: d[key][key_2][key_2_1]
    """
    if isinstance(path, dict):
        for k, v in path.items():
            if k in d:
                return get_nested_value(d[k], v)
            else:
                raise KeyError(f'Dictionary {d} does not have key {k}')
    else:
        return d[path]