code: def list_data_dirs(
      given_data_dir: Optional[ListOrElem[PathLike]] = None,
      dataset: Optional[str] = None,
  ) -> List[PathLike]:
      """Return the list of all `data_dir` to look-up.
  
      Args:
        given_data_dir: If a `data_dir` is provided, only the explicitly given
          `data_dir` will be returned, otherwise the list of all registered data_dir
          is returned
        dataset: Dataset to load.
  
      Returns:
        The list of all data_dirs to look-up.
      """
      # If the data dir is explicitly given, no need to search everywhere.
      if given_data_dir:
          if isinstance(given_data_dir, list):
              return given_data_dir
          else:
              return [given_data_dir]
      else:
          default_data_dir = get_default_data_dir(
              given_data_dir=given_data_dir, dataset=dataset
          )
          all_data_dirs = _registered_data_dir | {default_data_dir}
          return sorted(os.path.expanduser(d) for d in all_data_dirs)
  
imports: import collections
  import functools
  import os
  import re
  import time
  from typing import Iterator, List, Optional
  from absl import logging
  from etils import epath
  from tensorflow_datasets.core import constants
  from tensorflow_datasets.core import naming
  from tensorflow_datasets.core.utils import docs
  from tensorflow_datasets.core.utils import py_utils
  from tensorflow_datasets.core.utils import read_config
  from tensorflow_datasets.core.utils import type_utils
  from tensorflow_datasets.core.utils import version
label_desc: Use image node_id 3 for calling a global function with example usage: list_data_dirs(given_data_dir, dataset) and returns: sorted, given_data_dir, list