code: def _extract_ragged_attributes(
      nested_list, tensor_info: feature_lib.TensorInfo
  ):
      """Extract the values for the tf.RaggedTensor __init__.
  
      This extracts the ragged tensor attributes which allow to reconstruct the
      ragged tensor with `tf.RaggedTensor.from_nested_row_lengths`.
  
      Args:
        nested_list: A nested list containing the ragged tensor values
        tensor_info: The specs of the ragged tensor
  
      Returns:
        flat_values: The flatten values of the ragged tensor. All values from each
          list will be converted to np.array and stacked together.
        nested_row_lengths: The row lengths for each ragged dimensions.
      """
      assert tensor_info.sequence_rank, "{} is not ragged.".format(
          tensor_info
      )
  
      flat_values = []
      nested_row_lengths = [
          [] for _ in range(tensor_info.sequence_rank)
      ]
      # Recursively append to `flat_values`, `nested_row_lengths`
      _fill_ragged_attribute(
          RaggedExtraction(
              nested_list=nested_list,
              flat_values=flat_values,
              nested_row_lengths=nested_row_lengths,
              curr_ragged_rank=0,
              tensor_info=tensor_info,
          )
      )
      if not flat_values:  # The full sequence is empty
          flat_values = np.empty(
              shape=(0,)
              + tensor_info.shape[tensor_info.sequence_rank :],
              dtype=tensor_info.np_dtype,
          )
      else:  # Otherwise, merge all flat values together, some might be empty
          flat_values = np.stack(flat_values)
      return flat_values, nested_row_lengths[1:]
  
imports: from __future__ import annotations
  import abc
  import collections
  import dataclasses
  from typing import Any, Mapping, Union
  import numpy
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.features import feature
  from tensorflow_datasets.core.utils import dtype_utils
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  from tensorflow_datasets.proto import tf_example_pb2
  from tensorflow_datasets.proto import tf_feature_pb2
label_desc: Use image node_id 7 for calling a global function with example usage: _extract_ragged_attributes(nested_list, tensor_info) and returns: flat_values,  nested_row_lengths