code: def get_nested_attribute(
      obj, attribute_path, depth=None, return_key=False
  ):
      """
      Will return the result of a recursive get attribute call.
      E.g.:
          a.b.c
          = getattr(getattr(a, "b"), "c")
          = get_nested_attribute(a, "b.c")
      If any part of the attribute call is an integer x with current obj a, will
      try to call a[x] instead of a.x first.
      """
      attributes = attribute_path.split(".")
      if depth is not None and depth > 0:
          attributes = attributes[:depth]
      assert (
          len(attributes) > 0
      ), "At least one attribute should be selected"
      current_attribute = obj
      current_key = None
      for level, attribute in enumerate(attributes):
          current_key = ".".join(attributes[: level + 1])
          try:
              id_ = int(attribute)
              current_attribute = current_attribute[id_]
          except ValueError:
              current_attribute = getattr(current_attribute, attribute)
  
      return (
          (current_attribute, current_key)
          if return_key
          else current_attribute
      )
  
imports: import functools
  import importlib
  import os
  from functools import partial
  from inspect import isfunction
  import fsspec
  import numpy
  import torch
  from PIL import Image, ImageDraw, ImageFont
  from safetensors.torch import load_file
label_desc: Use image node_id 24 for calling a global function with example usage: get_nested_attribute(obj, attribute_path, depth, return_key) and returns: unknown