code: def test_find_builder_config_code(mock_fs: testing.MockFs):
      """When code exists, extract the default config name."""
  
      class MyDataset(
          testing.DummyMnist
      ):  # pylint: disable=unused-variable
          """Dummy dataset."""
  
          BUILDER_CONFIGS = [
              dataset_builder.BuilderConfig(  # pylint: disable=g-complex-comprehension
                  name=name,
                  version="2.0.0",
                  description=f"{name} description",
              )
              for name in ("default_config", "other_config")
          ]
  
      # Old version from before there were configs.
      mock_fs.add_file("path/to/my_dataset/0.0.1/features.json")
      mock_fs.add_file("path/to/my_dataset/0.1.0/features.json")
      mock_fs.add_file(
          "path/to/my_dataset/default_config/0.1.0/features.json"
      )
      mock_fs.add_file(
          "path/to/my_dataset/default_config/1.0.0/features.json"
      )
      mock_fs.add_file(
          "path/to/my_dataset/other_config/1.0.0/features.json"
      )
      mock_fs.add_file(
          "path/to/my_dataset/old_config/0.8.0/features.json"
      )
      mock_fs.add_file(
          "path/to/my_dataset/old_config/1.0.0/features.json"
      )
      mock_fs.add_file("path/to/my_dataset/broken_config/features.json")
  
      # If code can be reached, use it to load the default config name.
      # Note that the existing version is loaded, even if the code is at a
      # more recent version.
      assert (
          _find_builder_dir("my_dataset")
          == "path/to/my_dataset/default_config/1.0.0"
      )
      # Old version from previous configs.
      assert (
          _find_builder_dir("my_dataset:0.0.1")
          == "path/to/my_dataset/0.0.1"
      )
      # Explicitly given version with no config, use folder without config.
      assert (
          _find_builder_dir("my_dataset:0.1.0")
          == "path/to/my_dataset/0.1.0"
      )
      # Explicitly given version and config, use folder with config.
      assert (
          _find_builder_dir("my_dataset/default_config:0.1.0")
          == "path/to/my_dataset/default_config/0.1.0"
      )
      # When config is explicitly given, load the last detected version.
      assert (
          _find_builder_dir("my_dataset/other_config")
          == "path/to/my_dataset/other_config/1.0.0"
      )
      assert (
          _find_builder_dir("my_dataset/old_config")
          == "path/to/my_dataset/old_config/1.0.0"
      )
      assert (
          _find_builder_dir("my_dataset/old_config:0.8.0")
          == "path/to/my_dataset/old_config/0.8.0"
      )
      # When no config found, return None.
      assert _find_builder_dir("my_dataset/broken_config") is None
      assert _find_builder_dir("my_dataset/unknown_config") is None
  
imports: import contextlib
  import functools
  import os
  import pathlib
  import re
  from typing import Sequence
  from unittest import mock
  import dill
  from etils import epath
  import pytest
  import tensorflow
  from tensorflow_datasets import testing
  from tensorflow_datasets.core import constants
  from tensorflow_datasets.core import dataset_builder
  from tensorflow_datasets.core import dataset_utils
  from tensorflow_datasets.core import load
  from tensorflow_datasets.core import proto
  from tensorflow_datasets.core import read_only_builder
  from tensorflow_datasets.core import registered
  from tensorflow_datasets.core import splits
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.features import features_dict
  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 google.protobuf import json_format
label_desc: Use image node_id 20 for calling a global function with example usage: test_find_builder_config_code(mock_fs) without return types