code: def _get_ts_config_class(
      platform: str,
  ) -> type[TrainingServiceConfig] | None:
      from ..training_service import (
          TrainingServiceConfig,
      )  # avoid circular import
  
      # import all custom config classes so they can be found in TrainingServiceConfig.__subclasses__()
      custom_ts_config_path = nni.runtime.config.get_config_file(
          "training_services.json"
      )
      with custom_ts_config_path.open() as config_file:
          custom_ts_config = json.load(config_file)
      for custom_ts_pkg in custom_ts_config.keys():
          pkg = importlib.import_module(custom_ts_pkg)
          _config_class = pkg.nni_training_service_info.config_class
  
      for cls in _all_subclasses(TrainingServiceConfig):
          if cls.platform == platform:
              return cls
      return None
  
imports: from __future__ import annotations
  import copy
  import dataclasses
  import importlib
  import json
  import os.path
  from pathlib import Path
  import socket
  from typing import TYPE_CHECKING, get_type_hints
  import typeguard
  import nni.runtime.config
  from .public import is_missing
label_desc: Use image node_id 16 for calling a global function with example usage: _get_ts_config_class(platform) and returns: None, cls