code: def training_service_config_factory(
      platform: str,
  ) -> TrainingServiceConfig:
      cls = _get_ts_config_class(platform)
      if cls is None:
          raise ValueError(f"Bad training service platform: {platform}")
      return cls()
  
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 14 for calling a global function with example usage: training_service_config_factory(platform) and returns: cls