from typing import Dict
from typing import List


def subset_nested_dict(
    obj: Dict,
    key_sequence: List,
) -> Dict:
    """Create subset of nested dictionary.

    Args:
        obj: A (nested) dictionary.
        key_sequence: A sequence of keys, to be applied from outside to inside,
            pointing to the key (and descendants) to keep.

    Returns:
        Subset of input dictionary.
    """
    filt = {}
    if len(key_sequence):
        key = key_sequence.pop(0)
        filt[key] = obj[key]
        if len(key_sequence):
            filt[key] = subset_nested_dict(filt[key], key_sequence)
    return filt