docs: def set_value(obj, name, value):
    """A flexible method for setting a value on an object.
  
    If the object implements __setitem__ (such as a dict) performs obj[name] = value, else performs
    setattr(obj, name, value).
  
    :obj: the object to set the value on
    :name: the name to assign the value to
    :value: the value to assign
    """
    if hasattr(obj, "__setitem__"):
      obj[name] = value
    else:
      setattr(obj, name, value)