code: def isetattr(obj, attr, val):
      """
      Indexed setattr function
  
      Examples:
          >>> model = Model()
          >>> isetattr(model, "weight[2]", new_weight)
      """
      if "[" in attr and "]" in attr:
          element = attr.split("[")[0]
          element_obj = getattr(obj, element)
          attr = "".join("\t".join(attr.split("[")).split("]")).split(
              "\t"
          )[1:]
  
          for i in range(len(attr) - 1):
              element_obj = element_obj[int(attr[i])]
  
          element_obj[int(attr[-1])] = val
      else:
          setattr(obj, attr, val)
  
label_desc: Use image node_id 2 for calling a global function with example usage: isetattr(obj, attr, val) without return types