def nested_dict(key, value):
    """Create a nested dict if the key is a list of keywords"""
    if isinstance(key, list):
        d = {}
        ref = d
        for key_value in key:
            if key_value == key[-1]:
                d[key_value] = value
            else:
                d[key_value] = {}
                d = d[key_value]
    else:
        ref = {key: value}
    return ref
