code: def delete_old_versions(
      data_dir: pathlib.Path,
      skip_confirmation: bool = False,
  ) -> None:
      """Detects and deletes all datasets which are not in supported version."""
      # Extract the list of directory to keep and delete.
      dirs_to_keep, dirs_to_delete = _get_extra_dirs(
          data_dir=data_dir,
          # Explicitly set predicate_fn to None to load all datasets
          current_full_names=tfds.core.load.list_full_names(),
      )
  
      _display_dirs(
          data_dir=data_dir,
          dirs_to_keep=dirs_to_keep,
          dirs_to_delete=dirs_to_delete,
      )
  
      if skip_confirmation:
          delete = True
      else:
          delete = str(input("Do you want to continue (Y/n): ")) in (
              "Y",
              "y",
          )
      if not delete:
          print("Exiting the program without change!")
          return
  
      for path in dirs_to_delete:
          print(f"Delete: {path}")
          tf.io.gfile.rmtree(str(path))
      print("Add directories have been deleted!")
  
file_path: datasets/tensorflow_datasets/scripts/cleanup/delete_old_versions.py
imports: import collections
  import concurrent.futures
  import dataclasses
  import os
  import pathlib
  from typing import Dict, Iterable, List, Tuple
  from absl import app
  from absl import flags
  import tensorflow_datasets
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  import termcolor
label_desc: Use image node_id 7 for calling a global function with example usage: delete_old_versions(data_dir, skip_confirmation) without return types