code: def set_nested_attr(__obj: object, __name: str, __value: Any):
      """
      Set the nested named attribute on the given object to the specified value by a `.` separated name.
      set_nested_attr(x, 'y.z', v) is equivalent to setattr(getattr(x, 'y'), 'z', v) x.y.z = v.
      """
      pre, _, post = __name.rpartition(".")
      return setattr(
          get_nested_attr(__obj, pre) if pre else __obj, post, __value
      )
  
imports: from functools import reduce
  from typing import Any, overload
label_desc: Use image node_id 4 for calling a global function with example usage: set_nested_attr(__obj, __name, __value) and returns: setattr