code: def get_tuner(config: TaskConfig):
      name2tuner = get_tuner_class_dict()
      if config.framework_params["tuner_type"] not in name2tuner:
          raise RuntimeError("The requested tuner type is unavailable.")
      else:
          module_name = name2tuner[
              config.framework_params["tuner_type"]
          ]
          tuner_name = module_name.split(".")[-1]
          module_name = ".".join(module_name.split(".")[:-1])
          tuner_type = getattr(
              importlib.import_module(module_name), tuner_name
          )
  
          # special handlings for tuner initialization
          tuner = None
          if config.framework_params["tuner_type"] == "TPE":
              tuner = tuner_type("tpe")
  
          elif config.framework_params["tuner_type"] == "Random":
              tuner = tuner_type("random_search")
  
          elif config.framework_params["tuner_type"] == "Anneal":
              tuner = tuner_type("anneal")
  
          elif config.framework_params["tuner_type"] == "Hyperband":
              if "max_resource" in config.framework_params:
                  tuner = tuner_type(
                      R=config.framework_params["max_resource"]
                  )
              else:
                  tuner = tuner_type()
  
          elif config.framework_params["tuner_type"] == "BOHB":
              if "max_resource" in config.framework_params:
                  tuner = tuner_type(
                      max_budget=config.framework_params["max_resource"]
                  )
              else:
                  tuner = tuner_type(max_budget=60)
  
          else:
              tuner = tuner_type()
  
          assert tuner is not None
  
          return tuner, config.framework_params["tuner_type"]
  
file_path: nni/examples/trials/benchmarking/automlbenchmark/nni/extensions/NNI/tuners.py
imports: import os
  import yaml
  import importlib
  import nni
  from nni.runtime.config import get_config_file
  from nni.utils import MetricType
  from nni.tuner import Tuner
  from nni.runtime.msg_dispatcher_base import MsgDispatcherBase
  from amlb.benchmark import TaskConfig
label_desc: Use image node_id 2 for calling a global function with example usage: get_tuner(config) and returns: tuner,  config