def set_in(dct, keys, value):
    """Sets the value in dct at the nested path indicated by keys"""
    for key in keys[:-1]:
        if key not in dct:
            dct[key] = {}
        dct = dct[key]
    leaf_key = keys[-1]
    if leaf_key in dct and isinstance(dct[leaf_key], dict):
        raise Exception(
            f"Unable to set value because {'.'.join(keys)} is a configuration section."
            )
    else:
        dct[leaf_key] = value
