code: def _adjust_function_closure(fn, closure):
      out = types.FunctionType(
          code=fn.__code__,
          globals=fn.__globals__,
          name=fn.__name__,
          argdefs=fn.__defaults__,
          closure=closure,
      )
      out.__module__ = fn.__module__
      out.__qualname__ = fn.__qualname__
      out.__doc__ = fn.__doc__
      out.__annotations__.update(fn.__annotations__)
      if fn.__kwdefaults__ is not None:
          out.__kwdefaults__ = fn.__kwdefaults__.copy()
      return out
  
file_path: equinox/equinox/internal/_closure_to_pytree.py
imports: import inspect
  import types
  from typing import Any, Optional
  import jax.tree_util
  from .._module import Module
label_desc: Use image node_id 2 for calling a global function with example usage: _adjust_function_closure(fn, closure) and returns: out