code: def stop_experiment(args):
      """Stop the experiment which is running"""
      if args.id and args.id == "all":
          print_warning(
              "'nnictl stop all' is abolished, please use 'nnictl stop --all' to stop all of experiments!"
          )
          exit(1)
      experiment_id_list = parse_ids(args)
      if experiment_id_list:
          for experiment_id in experiment_id_list:
              print_normal("Stopping experiment %s" % experiment_id)
              # FIXME: Retry should be placed to `Experiments`, need review both python and ts code.
              # retry up to 10 times to get the experiment metadata
              for i in range(1, 11):
                  experiments_dict = Experiments().get_all_experiments()
                  experiment_info = experiments_dict.get(experiment_id)
                  if experiment_info is None:
                      print_warning(
                          "Get experiment {} metadata failed, {} time retry...".format(
                              experiment_id, i
                          )
                      )
                      time.sleep(0.5)
                  else:
                      break
              if experiment_info is None:
                  print_error(
                      "Experiment {} metadata getting failed.".format(
                          experiment_id
                      )
                  )
                  print_error(
                      "The experiments metadata in `.experiment` is:"
                  )
                  print_error(
                      json.dumps(
                          Experiments().get_all_experiments(), indent=4
                      )
                  )
                  exit(1)
              rest_pid = experiment_info.get("pid")
              if rest_pid:
                  kill_command(rest_pid)
              print_normal("Stop experiment success.")
  
imports: import csv
  import os
  import sys
  import json
  import time
  import shutil
  import subprocess
  from functools import cmp_to_key
  import traceback
  from datetime import datetime, timezone
  from subprocess import Popen
  from .rest_utils import rest_get, rest_delete, check_rest_server_quick, check_response
  from .url_utils import trial_jobs_url, experiment_url, trial_job_id_url, export_data_url, metric_data_url
  from .config_utils import Config, Experiments
  from .constants import NNI_HOME_DIR, EXPERIMENT_INFORMATION_FORMAT, EXPERIMENT_DETAIL_FORMAT, EXPERIMENT_MONITOR_INFO, TRIAL_MONITOR_HEAD, TRIAL_MONITOR_CONTENT, TRIAL_MONITOR_TAIL, REST_TIME_OUT
  from .common_utils import print_normal, print_error, print_warning, detect_process, get_yml_content, generate_temp_dir
  from .common_utils import print_green
  from .command_utils import check_output_command, kill_command
  from .ssh_utils import create_ssh_sftp_client, remove_remote_directory
label_desc: Use image node_id 10 for calling a global function with example usage: stop_experiment(args) without return types