code: def create_experiment(args):
      """start a new experiment"""
      experiment_id = "".join(
          random.sample(string.ascii_letters + string.digits, 8)
      )
      config_path = os.path.abspath(args.config)
      if not os.path.exists(config_path):
          print_error("Please set correct config path!")
          exit(1)
      config_yml = get_yml_content(config_path)
  
      if "trainingServicePlatform" in config_yml:
          _validate_v1(config_yml, config_path)
          platform = config_yml["trainingServicePlatform"]
          if platform in k8s_training_services:
              schema = 1
              config_v1 = config_yml
          else:
              schema = 2
              config_v2 = convert.to_v2(config_yml).json()
      else:
          config_v2 = _validate_v2(config_yml, config_path)
          schema = 2
  
      try:
          if schema == 1:
              launch_experiment(
                  args, config_v1, "create", experiment_id, 1
              )
          else:
              launch_experiment(
                  args, config_v2, "create", experiment_id, 2
              )
      except Exception as exception:
          restServerPid = (
              Experiments()
              .get_all_experiments()
              .get(experiment_id, {})
              .get("pid")
          )
          if restServerPid:
              kill_command(restServerPid)
          print_error(exception)
          exit(1)
  
imports: import json
  import os
  from pathlib import Path
  import sys
  import string
  import random
  import time
  import re
  from subprocess import Popen, check_call, CalledProcessError, PIPE, STDOUT
  from nni.experiment.config import ExperimentConfig, convert
  from nni.tools.package_utils.tuner_factory import get_builtin_module_class_name
  from .launcher_utils import validate_all_content
  from .rest_utils import rest_put, rest_post, check_rest_server, check_response
  from .url_utils import cluster_metadata_url, experiment_url, get_local_urls, set_prefix_url
  from .config_utils import Config, Experiments
  from .common_utils import get_yml_content, get_json_content, print_error, print_normal, detect_port
  from .constants import NNI_HOME_DIR, ERROR_INFO, REST_TIME_OUT, EXPERIMENT_SUCCESS_INFO, LOG_HEADER
  from .command_utils import check_output_command, kill_command
  from .nnictl_utils import update_experiment
label_desc: Use image node_id 19 for calling a global function with example usage: create_experiment(args) without return types