code: def load_training_service_config(config) -> TrainingServiceConfig:
      if isinstance(config, dict) and "platform" in config:
          cls = _get_ts_config_class(config["platform"])
          if cls is not None:
              return cls(**config)
      # not valid json, don't touch
      return config
  
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 15 for calling a global function with example usage: load_training_service_config(config) and returns: config, cls