code: def _flatten_composite_array(x, expand_composites=False):
      if isinstance(x, ragged_tf.RaggedTensor):
          if not expand_composites:
              return x
          new_struc = [x.flat_values]
          for row_split in x.nested_row_splits:
              new_struc.append(row_split)
          return new_struc
      elif ivy.is_ivy_sparse_array(x) or ivy.is_native_sparse_array(x):
          return ivy.native_sparse_array_to_indices_values_and_shape(x)
  
imports: import ivy.functional.frontends.tensorflow.ragged
  from ivy.functional.frontends.tensorflow.func_wrapper import to_ivy_arrays_and_back
  import ivy
label_desc: Use image node_id 1 for calling a global function with example usage: _flatten_composite_array(x, expand_composites) and returns: new_struc, x, ivy