code: def _get_version_str(
      builder_dir: epath.Path,
      *,
      config_name: Optional[str] = None,
      requested_version: Optional[str] = None,
  ) -> Optional[str]:
      """Returns the version name found in the directory.
  
      Args:
        builder_dir: Directory containing the versions (`builder_dir/1.0.0/`,...)
        config_name: Optional name of the config that should be used. Will be
          ignored if it is an empty string.
        requested_version: Optional version to search (e.g. `1.0.0`, `2.*.*`,...)
  
      Returns:
        version_str: The version directory name found in `builder_dir`.
      """
      if config_name:
          builder_dir = builder_dir / config_name
      all_versions = version_lib.list_all_versions(
          os.fspath(builder_dir)
      )
      # Version not given, using the latest one.
      if not requested_version and all_versions:
          return str(all_versions[-1])
      # Version given, return the highest version matching `requested_version`.
      for v in reversed(all_versions):
          if v.match(requested_version):
              return str(v)
      # Directory doesn't have version, or requested_version doesn't match
      if requested_version:
          error_msg = (
              f"No version matching the requested {requested_version} was "
              f"found in the builder directory: {builder_dir}."
          )
      else:
          error_msg = f"The builder directory {builder_dir} doesn't contain any versions."
      error_utils.add_context(error_msg)
      return None
  
imports: import functools
  import os
  import typing
  from typing import Any, List, Optional, Tuple, Type
  from etils import epath
  from tensorflow_datasets.core import dataset_builder
  from tensorflow_datasets.core import dataset_info
  from tensorflow_datasets.core import logging
  from tensorflow_datasets.core import naming
  from tensorflow_datasets.core import registered
  from tensorflow_datasets.core import splits
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.features import feature
  from tensorflow_datasets.core.proto import dataset_info_pb2
  from tensorflow_datasets.core.utils import error_utils
  from tensorflow_datasets.core.utils import file_utils
  from tensorflow_datasets.core.utils import version
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
label_desc: Use image node_id 10 for calling a global function with example usage: _get_version_str(builder_dir) and returns: None, str, str