code: def flatten_with_tuple_paths_up_to(
      shallow_structure,
      input_structure,
      check_types=True,
      expand_composites=False,
  ):
      if expand_composites:
          raise NotImplementedError(
              "`expand_composites=True` is not supported in JAX."
          )
      return dm_tree.flatten_with_path_up_to(
          shallow_structure, input_structure, check_types
      )
  
imports: import collections
  from collections import abc
  import types
  import tree
label_desc: Use image node_id 6 for calling a global function with example usage: flatten_with_tuple_paths_up_to(shallow_structure, input_structure, check_types, expand_composites) and returns: dm_tree