code: def deep_ast_copy(obj):
      """
      Much, much faster than copy.deepcopy, but just for parser tree nodes.
      """
      # If it's already in the cache, just return it.
      new_obj = copy.copy(obj)
  
      # Copy children
      new_children = []
      for child in obj.children:
          if isinstance(child, tree.Leaf):
              new_child = copy.copy(child)
              new_child.parent = new_obj
          else:
              new_child = deep_ast_copy(child)
              new_child.parent = new_obj
          new_children.append(new_child)
      new_obj.children = new_children
  
      return new_obj
  
imports: import copy
  import sys
  import re
  import os
  from itertools import chain
  from contextlib import contextmanager
  from parso.python import tree
  from jedi._compatibility import unicode
  from jedi.parser_utils import get_parent_scope
label_desc: Use image node_id 2 for calling a global function with example usage: deep_ast_copy(obj) and returns: new_obj