code: def test_closure_same_name():
      def f(flag):
          if flag:
  
              def g(y):
                  return 1 + y
  
          else:
  
              def g(y):
                  return 2 + y
  
          def h(y):
              return g(y)
  
          return h
  
      h1 = eqxi.closure_to_pytree(f(True))
      h2 = eqxi.closure_to_pytree(f(False))
  
      @eqx.filter_jit
      def run(f, y):
          return f(y)
  
      assert run(h1, jnp.array(1.0)) == 2
      assert run(h2, jnp.array(1.0)) == 3
  
file_path: equinox/tests/test_closure_to_pytree.py
imports: import equinox
  import equinox.internal
  import jax
  import jax.numpy
  import jax.tree_util
  import optax
label_desc: Use image node_id 2 for calling a global function with example usage: test_closure_same_name() and returns: h, f, g, unknown, unknown