code: def _get_sequence_rank(serialized_info) -> int:
      """Return the number of sequence dimensions of the feature."""
  
      if isinstance(serialized_info, dict):
          # If the element is a dictionary, it might correspond to a nested dataset
          # whose serialized_info is not flattened (so it might be a nested dict).
          all_sequence_rank = [
              _get_sequence_rank(s) for s in serialized_info.values()
          ]
      else:
          # If this is a nested dataset, we ignore the sequence_rank. We will decode
          # the full dataset example with the Dataset decoder.
          if serialized_info.dataset_lvl > 0:
              return 0
          all_sequence_rank = [serialized_info.sequence_rank]
      sequence_ranks = set(all_sequence_rank)
      if len(sequence_ranks) != 1:
          raise NotImplementedError(
              "Decoding do not support mixing sequence and context features within a "
              "single FeatureConnector. Received inputs of different sequence_rank: "
              "{}".format(sequence_ranks)
          )
      return next(iter(sequence_ranks))
  
imports: from __future__ import annotations
  import enum
  import functools
  from typing import Any, List, Union
  from tensorflow_datasets.core import example_parser
  from tensorflow_datasets.core import example_serializer
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.features import feature
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
label_desc: Use image node_id 2 for calling a global function with example usage: _get_sequence_rank(serialized_info) and returns: next, int