code: def _pytree_flatten(obj):
      """Flatten method for JAX pytrees."""
      # pylint: disable=protected-access
      components = obj._type_spec._to_components(obj)
      if components:
          keys, values = zip(*components.items())
      else:
          keys, values = (), ()
      metadata = dict(
          non_tensor_params=obj._type_spec._non_tensor_params,
          structure_with_callables=obj._type_spec._structure_with_callables,
      )
      return values, (keys, metadata)
  
imports: import collections
  import functools
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import joint_distribution_sequential
  from tensorflow_probability.python.internal import auto_composite_tensor
  from tensorflow_probability.python.internal import distribution_util
label_desc: Use image node_id 7 for calling a global function with example usage: _pytree_flatten(obj) and returns: values,  keys,  metadata