class_docstr: Tune driver
class_docstr_tok: ["Tune","driver"]
code: def _set_search_alg(search_alg, search_alg_params, metric, mode):
      if search_alg:
          if not isinstance(search_alg, str):
              raise ValueError(
                  f"search_alg should be of type str."
                  f" Got {search_alg.__class__.__name__}"
              )
          params = (
              search_alg_params.copy() if search_alg_params else dict()
          )
          if metric and "metric" not in params:
              params["metric"] = metric
          if mode and "mode" not in params:
              params["mode"] = mode
          search_alg = tune.create_searcher(search_alg, **params)
      return search_alg
  
imports: import ray
  from ray import tune
  import os
  from zoo.orca.automl.search.base import SearchEngine, TrialOutput, GoodError
  from zoo.orca.automl.search.parameters import DEFAULT_LOGGER_NAME, DEFAULT_METRIC_NAME
  from zoo.orca.automl.search.ray_tune.utils import convert_bayes_configs
  from zoo.orca.automl.search.utils import get_ckpt_hdfs, put_ckpt_hdfs
  from zoo.orca.automl.search import TensorboardLogger
  from ray.tune import Stopper
  from zoo.orca.automl.model.abstract import ModelBuilder
label_desc: Use image node_id 4 for calling the RayTuneSearchEngine obj's underlying member method code with example usage: obj._set_search_alg(search_alg, search_alg_params, metric, mode) and returns: search_alg