def deep_insert(path_list, value, config):
    """Inserts value into config by path, generating intermediate dictionaries.

    Example:
        >>> deep_insert(path.split("."), value, {})
    """
    if len(path_list) > 1:
        inside_config = config.setdefault(path_list[0], {})
        deep_insert(path_list[1:], value, inside_config)
    else:
        config[path_list[0]] = value