def nested_get(
    d: Union[FrozenDict[AnyKey, Any], Dict[AnyKey, Any]], keys: List[AnyKey]
) -> Dict[AnyKey, Any]:
    """
    Get a sub-nested dictionary from a dictionary `d`. `keys` is the sequence of keys leading to the nested
    sub-dictionary.

    :param d: Dict[AnyKey, Any]
        Nested dictionary.
    :param keys: List[AnyKey
        Sequence of keys.

    :return: Dict[AnyKey, Any]
        The sub-nested dictionary.
    """
    if len(keys) == 0:
        raise ValueError("`keys` should not be empty.")
    if len(keys) == 1:
        return d[keys[0]]
    return nested_get(d[keys[0]], keys[1:])

    Get a sub-nested dictionary from a dictionary `d`. `keys` is the sequence of keys leading to the nested
    sub-dictionary.

    :param d: Dict[AnyKey, Any]
        Nested dictionary.
    :param keys: List[AnyKey
        Sequence of keys.

    :return: Dict[AnyKey, Any]
        The sub-nested dictionary.
    
fortuna/utils/nested_dicts.py