from typing import Dict


def _dictify(data, keys, val) -> Dict:
    """
    Helper function to generate nested dictionary from list of keys and value. 
    Calls itself recursively.
    
    Arguments:
        data (dict): dictionary to add value to with keys
        keys (list): list of keys to traverse along tree and place value
        val (dict): value for innermost layer of nested dict

    Returns:
        data (dict): A nested dictionary respresenting the (sub-)nodetree data 
            structure.

    """
    key = keys[0]
    key = int(key) if key.isdecimal() else key.lower()
    if len(keys) == 1:
        data[key] = val
    else:
        if key in data.keys():
            data[key] = _dictify(data[key], keys[1:], val)
        else:
            data[key] = _dictify({}, keys[1:], val)
    return data