code: def flatten_up_to(*args, expand_composites=False, **kwargs):
      # Internal `tree` does not accept check_types here; see b/198436438.
      # Apparently the open-source version of same still does.
      #   kwargs.pop('check_types', None)  # DisableOnExport
      if expand_composites:
          raise NotImplementedError(
              "`expand_composites=True` is not supported in JAX."
          )
      return dm_tree.flatten_up_to(*args, **kwargs)
  
imports: import collections
  from collections import abc
  import types
  import tree
label_desc: Use image node_id 3 for calling a global function with example usage: flatten_up_to() and returns: dm_tree