def update_dict_path(base, path, value, default=dict):
    """

    Set the dict path ``path`` on the dict ``base`` to ``value``.  If the path
    does not yet exist, the callable ``default`` will be used to create it.

    A dict path is a way to represent an item deep inside a dict structure.
    For example, the dict path ``["a", "b"]`` represents the number 42 in the
    dict ``{"a": {"b": 42}}``
    """
    path = list(path)
    level = path.pop(0)

    if path: # we need to go at least one level deeper
        base.setdefault(level, default())
        update_dict_path(base[level], path, value, default)
    else: # level is the level we are trying to set
        base[level] = value
    return base