code: def map_structure_with_tuple_paths_up_to(
      shallow_structure,
      func,
      *structures,
      expand_composites=False,
      **kwargs,
  ):
      """Wraps nest.map_structure_with_path_up_to, with structure/type checking."""
      if not structures:
          raise ValueError("Cannot map over no sequences")
  
      # Internal `tree` does not accept check_types here; see b/198436438.
      check_types = kwargs.get("check_types", True)
      kwargs.pop("check_types", None)
  
      if expand_composites:
          raise NotImplementedError(
              "`expand_composites=True` is not supported in JAX."
          )
  
      for input_tree in structures:
          assert_shallow_structure(
              shallow_structure, input_tree, check_types=check_types
          )
      return dm_tree.map_structure_with_path_up_to(
          shallow_structure, func, *structures, **kwargs
      )
  
imports: import collections
  from collections import abc
  import types
  import tree
label_desc: Use image node_id 12 for calling a global function with example usage: map_structure_with_tuple_paths_up_to(shallow_structure, func) and returns: dm_tree