code: def _tf_core_flatten_up_to(
      shallow_tree,
      input_tree,
      check_types=True,
      expand_composites=False,
  ):
      is_nested_fn = (
          _is_nested_or_composite
          if expand_composites
          else _tf_core_is_nested
      )
      _tf_core_assert_shallow_structure(
          shallow_tree,
          input_tree,
          check_types=check_types,
          expand_composites=expand_composites,
      )
      # Discard paths returned by nest_util._tf_core_yield_flat_up_to.
      return [
          v
          for _, v in _tf_core_yield_flat_up_to(
              shallow_tree, input_tree, is_nested_fn
          )
      ]
  
imports: import collections
  import enum
  import wrapt
  from tensorflow.python import pywrap_tensorflow
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.util import _pywrap_utils
  from tensorflow.python.util.compat import collections_abc
  from tensorflow.python.util.custom_nest_protocol import CustomNestProtocol
label_desc: Use image node_id 32 for calling a global function with example usage: _tf_core_flatten_up_to(shallow_tree, input_tree, check_types, expand_composites) and returns: unknown