def build_dct(dic, keys, value):
    key = keys.pop(0)
    if len(keys):
        dic.setdefault(key, {})
        build_dct(dic[key], keys, value)
    else:
        # Transform cookbook default attribute strings into proper booleans
        if value == "false":
            value = False
        elif value == "true":
            value = True
        # It's a leaf, assign value
        dic[key] = deepcopy(value)
Builds a dictionary with arbitrary depth out of a key list
dataset/ETHPy150Open tobami/littlechef/littlechef/chef.py/build_dct