code: def lightgbm_eval_metric(ml_task, automl_eval_metric):
      if automl_eval_metric == "user_defined_metric":
          return "custom", automl_eval_metric
      metric_name_mapping = {
          BINARY_CLASSIFICATION: {
              "auc": "auc",
              "logloss": "binary_logloss",
              "f1": "custom",
              "average_precision": "custom",
              "accuracy": "custom",
          },
          MULTICLASS_CLASSIFICATION: {
              "logloss": "multi_logloss",
              "f1": "custom",
              "accuracy": "custom",
          },
          REGRESSION: {
              "rmse": "rmse",
              "mse": "l2",
              "mae": "l1",
              "mape": "mape",
              "r2": "custom",
              "spearman": "custom",
              "pearson": "custom",
          },
      }
  
      metric = metric_name_mapping[ml_task][automl_eval_metric]
      custom_eval_metric = None
  
      if automl_eval_metric in [
          "r2",
          "spearman",
          "pearson",
          "f1",
          "average_precision",
          "accuracy",
      ]:
          custom_eval_metric = automl_eval_metric
  
      return metric, custom_eval_metric
  
imports: import contextlib
  import copy
  import logging
  import os
  import time
  import lightgbm
  import numpy
  import pandas
  from sklearn.base import ClassifierMixin, RegressorMixin
  from supervised.algorithms.algorithm import BaseAlgorithm
  from supervised.algorithms.registry import BINARY_CLASSIFICATION, MULTICLASS_CLASSIFICATION, REGRESSION, AlgorithmsRegistry
  from supervised.utils.config import LOG_LEVEL
  from supervised.utils.metric import lightgbm_eval_metric_accuracy, lightgbm_eval_metric_average_precision, lightgbm_eval_metric_f1, lightgbm_eval_metric_pearson, lightgbm_eval_metric_r2, lightgbm_eval_metric_spearman, lightgbm_eval_metric_user_defined
label_desc: Use image node_id 2 for calling a global function with example usage: lightgbm_eval_metric(ml_task, automl_eval_metric) and returns: metric,  custom_eval_metric, str,  automl_eval_metric