code: def compile_function_src(
      src: str,
      function_name: str,
      global_env: Optional[dict[Any, Any]] = None,
      local_env: Optional[dict[Any, Any]] = None,
  ) -> Callable:
      with NamedTemporaryFile(delete=False) as f:
          filename = f.name
          f.write(src.encode())
  
      if global_env is None:
          global_env = {}
  
      if local_env is None:
          local_env = {}
  
      mod_code = compile(src, filename, mode="exec")
      exec(mod_code, global_env, local_env)
  
      res = cast(Callable, local_env[function_name])
      res.__source__ = src  # type: ignore
      return res
  
imports: import builtins
  import io
  import re
  import sys
  import traceback
  import warnings
  from collections import Counter, defaultdict
  from collections.abc import Iterable, Sequence
  from keyword import iskeyword
  from operator import itemgetter
  from tempfile import NamedTemporaryFile
  from textwrap import dedent, indent
  from typing import TYPE_CHECKING, Any, Callable, NoReturn, Optional, TextIO, TypeVar, Union, cast
  import numpy
  from pytensor import config, utils
  from pytensor.graph.basic import Apply, Constant, Variable
  from pytensor.graph.fg import FunctionGraph
label_desc: Use image node_id 7 for calling a global function with example usage: compile_function_src(src, function_name, global_env, local_env) and returns: res