code: def _get_config_name(
      builder_cls: Type[tfds.core.DatasetBuilder],
      config_kwarg: Optional[str],
      config_name: Optional[str],
      config_idx: Optional[int],
  ) -> Optional[Union[str, tfds.core.BuilderConfig]]:
      """Extract the config name.
  
      Args:
        builder_cls: Builder class
        config_kwarg: Config passed as `ds_name/config`
        config_name: Config passed as `--config name`
        config_idx: Config passed as `--config_idx 0`
  
      Returns:
        The config name to generate, or None.
      """
      num_config = sum(
          c is not None for c in (config_kwarg, config_name, config_idx)
      )
      if num_config > 1:
          raise ValueError(
              "Config should only be defined once by either `ds_name/config`, "
              "`--config` or `--config_idx`"
          )
      elif num_config == 1 and not builder_cls.BUILDER_CONFIGS:
          raise ValueError(
              f"Cannot generate requested config: Dataset {builder_cls.name} does "
              "not have config."
          )
  
      if config_kwarg:  # `ds_name/config`
          return config_kwarg
      elif config_name:  # `--config name`
          if config_name.startswith("{"):
              # Json: Dynamically recreate the builder_config
              return builder_cls.builder_config_cls(
                  **json.loads(config_name)
              )
          else:
              return config_name
      elif config_idx is not None:  # `--config_idx 123`
          if config_idx > len(builder_cls.BUILDER_CONFIGS):
              raise ValueError(
                  f"--config_idx {config_idx} greater than number "
                  f"of configs {len(builder_cls.BUILDER_CONFIGS)} for "
                  f"{builder_cls.name}."
              )
          else:
              # Use `config.name` to avoid
              # https://github.com/tensorflow/datasets/issues/2348
              return builder_cls.BUILDER_CONFIGS[config_idx].name
      else:  # No config defined
          return None
  
imports: import argparse
  import functools
  import importlib
  import itertools
  import json
  import multiprocessing
  import os
  import typing
  from typing import Dict, Iterator, Optional, Tuple, Type, Union
  from absl import logging
  from etils import epath
  import tensorflow_datasets
label_desc: Use image node_id 13 for calling a global function with example usage: _get_config_name(builder_cls, config_kwarg, config_name, config_idx) and returns: config_kwarg, builder_cls, config_name, None, builder_cls