code: def run_config_entity(
      params_given, dir_sid, expected_timecost="inf", tune_slot_id=0
  ):
      dir_sid = str(dir_sid)
      result_file = local_get_dir_file("result.txt", dir_sid)
      try:
          os.remove(result_file)
      except:
          pass
      config_str = json.dumps(params_given)
      envs = os.environ.copy()
      envs["CONFIG"] = config_str
      envs["DIR_SID"] = dir_sid
      envs["CUDA_VISIBLE_DEVICES"] = str(tune_slot_id)
      print(
          "  >> Try param_entity on sid = %s: config = %s, slot_id = %d"
          % (dir_sid, config_str, tune_slot_id)
      )
      try:
          assert True == run_process_with_timeout(
              ["python%d" % sys.version_info.major] + sys.argv,
              envs=envs,
          )
          result = float(open(result_file, "r").read().strip())
      except:
          result = float("inf")
      print(
          "  >> Try param_entity on sid = %s: result = `%.6f`"
          % (dir_sid, result)
      )
      return result
  
imports: import numpy
  import tvm
  import logging
  import math
  import re
  import sys, time, subprocess, os, random, hashlib
  from tvm import autotvm
  import topi
  import json
  from topi.util import get_const_tuple
  import importlib
  from tvm.autotvm.task.dispatcher import ApplyConfig
  from tvm.autotvm.task import ConfigEntity
  from threading import Timer
label_desc: Use image node_id 9 for calling a global function with example usage: run_config_entity(params_given, dir_sid, expected_timecost, tune_slot_id) and returns: result