docs: def set_value(instance, path, value, ref=None):
      """
      Set `value` on `instance` at the given `path` and create missing intermediate objects.
  
      Parameters
      ----------
      instance : dict or list
          instance from which to retrieve a value
      path : str
          path to retrieve a value from
      value :
          value to set
      ref : str or None
          reference path if `path` is relative
      """
      *head, tail = split_path(path, ref)
      for part in head:
          instance = instance.setdefault(part, {})
      instance[tail] = value