code: def _check_optimize_direction(direction, directions, metric):
      # TODO check common metrics and corresponding directions
      if (
          isinstance(metric, list) or isinstance(metric, tuple)
      ) and len(metric) > 1:
          # multi-objective search
          invalidInputError(
              directions is not None and len(directions) == len(metric),
              "In multi-objective optimization, you must explicitly specify "
              "the direction for each metric",
          )
      else:
          if not direction and not directions:
              direction = "minimize"
          max_metrics = ["accuracy", "auc", "acc"]
          min_metrics = ["loss", "mae", "mse"]
          stripped_metric = _strip_val_prefix(metric).lower()
          if stripped_metric in max_metrics:
              if direction != "maximize":
                  invalidInputError(
                      False, "should use maximize direction for optmize"
                  )
          elif stripped_metric in min_metrics:
              if direction != "minimize":
                  invalidInputError(
                      False, "should use minimize direction for optmize"
                  )
  
file_path: BigDL/python/nano/src/bigdl/nano/automl/hpo/search.py
imports: import optuna
  from bigdl.nano.utils.common import invalidInputError
label_desc: Use image node_id 9 for calling a global function with example usage: _check_optimize_direction(direction, directions, metric) without return types