code: def _check_tree_and_avals(what, tree1, avals1, tree2, avals2):
      """Raises TypeError if (tree1, avals1) does not match (tree2, avals2).
  
      Corresponding `tree` and `avals` must match in the sense that the number of
      leaves in `tree` must be equal to the length of `avals`. `what` will be
      prepended to details of the mismatch in TypeError.
      """
      if tree1 != tree2:
          raise TypeError(
              f"{what} must have same type structure, got {tree1} and {tree2}."
          )
      if not all(map(core.typematch, avals1, avals2)):
          diff = tree_map(
              _show_diff,
              tree_unflatten(tree1, avals1),
              tree_unflatten(tree2, avals2),
          )
          raise TypeError(
              f"{what} must have identical types, got\n{diff}."
          )
  
imports: from __future__ import annotations
  from collections.abc import Sequence
  import os
  from functools import partial
  from typing import Any, Callable
  from jax._src import core
  from jax._src import linear_util
  from jax._src.lax import lax
  from jax._src import effects
  from jax._src import ad_util
  from jax._src import state
  from jax._src import util
  from jax._src.util import cache, weakref_lru_cache, safe_map, unzip3, partition_list
  from jax.api_util import flatten_fun_nokwargs
  from jax._src.interpreters import partial_eval
  from jax.tree_util import tree_map, tree_unflatten
label_desc: Use image node_id 6 for calling a global function with example usage: _check_tree_and_avals(what, tree1, avals1, tree2, avals2) without return types