code: def unshuffle_tensorflow_dataset(X) -> tuple:
      """Applies iterative inverse transformations to dataset to get version before ShuffleDataset was created.
      If no ShuffleDataset is in the transformation-history of this dataset, returns None.
  
      Parameters
      ----------
      X : a tensorflow Dataset that may have been created via series of transformations, one being shuffle.
  
      Returns
      -------
      Tuple (pre_X, buffer_size) where:
        pre_X : Dataset that was previously transformed to get ShuffleDataset (or None),
        buffer_size : int `buffer_size` previously used in ShuffleDataset,
          or ``len(pre_X)`` if buffer_size cannot be determined, or None if no ShuffleDataset found.
      """
      try:
          from tensorflow.python.data.ops.dataset_ops import (
              ShuffleDataset,
          )
  
          X_inputs = [X]
          while len(X_inputs) == 1:
              pre_X = X_inputs[0]
              if isinstance(pre_X, ShuffleDataset):
                  buffer_size = len(pre_X)
                  if hasattr(pre_X, "_buffer_size"):
                      buffer_size = pre_X._buffer_size.numpy()
                  X_inputs = (
                      pre_X._inputs()
                  )  # get the dataset that was transformed to create the ShuffleDataset
                  if len(X_inputs) == 1:
                      return (X_inputs[0], buffer_size)
              X_inputs = (
                  pre_X._inputs()
              )  # returns list of input datasets used to create X
      except Exception:
          pass
      return (None, None)
  
imports: import warnings
  import numpy
  import pandas
  from typing import Union, Tuple
  from cleanlab.typing import DatasetLike, LabelLike
  from cleanlab.internal.validation import labels_to_array
  from cleanlab.internal.constants import FLOATING_POINT_COMPARISON, TINY_VALUE
label_desc: Use image node_id 21 for calling a global function with example usage: unshuffle_tensorflow_dataset(X) and returns: None,  None, X_inputs,  buffer_size