code: def get_subtree(tree, name):
      for item in tree.body:
          if isinstance(item, ast.Assign):
              if name in [
                  i.id for i in item.targets if hasattr(i, "id")
              ]:
                  return item
              for target in item.targets:
                  if isinstance(target, ast.Tuple):
                      if name in [i.id for i in target.elts]:
                          return item
          if isinstance(item, ast.AnnAssign):
              if name == item.target.id:
                  return item
          if not hasattr(item, "name"):
              continue
          if item.name == name:
              return item
      raise ValueError(f"no such item {name} in tree")
  
imports: import ast
  import pathlib
  import sys
label_desc: Use image node_id 4 for calling a global function with example usage: get_subtree(tree, name) and returns: item, item, item, item