code: def _finalise_jaxprs_in_params(params):
      new_params = {}
      for key, val in params.items():
          if (
              type(val) is tuple
          ):  # not isinstance to avoid breaking namedtuples
              val = tuple(_maybe_finalise_jaxpr(v) for v in val)
          else:
              val = _maybe_finalise_jaxpr(val)
          new_params[key] = val
      return new_params
  
imports: import functools
  from collections.abc import Callable
  from typing import Any, cast, Literal, overload, Union
  import jax
  import jax.core
  import jax.custom_derivatives
  import jax.tree_util
  from jaxtyping import PyTree
  from .._unvmap import unvmap_all_p, unvmap_any_p, unvmap_max_p
  from ..debug._announce_transform import announce_jaxpr_p
  from ._loop import maybe_set_p, select_if_vmap_p
  from ._noinline import noinline_p
  from ._nontraceable import nonbatchable_p, nondifferentiable_backward_p, nontraceable_p
label_desc: Use image node_id 3 for calling a global function with example usage: _finalise_jaxprs_in_params(params) and returns: new_params