code: def function_to_ast(fn):
      """
      Get the AST representation of a function
      """
      # Get source code for function
      # Dedent is needed if this is a nested function
      fn_source = textwrap.dedent(inspect.getsource(fn))
  
      # Parse function source code into an AST
      fn_ast = ast.parse(fn_source)
  
      # # The function will be the fist element of the module body
      # fn_ast = module_ast.body[0]
  
      return fn_ast
  
imports: import re
  import copy
  import inspect
  import ast
  import textwrap
label_desc: Use image node_id 1 for calling a global function with example usage: function_to_ast(fn) and returns: fn_ast