code: def _get_loss_func(objective: str, class_num=None):
      # to lowercase
      objective = objective.lower()
      assert (
          objective in OBJECTIVE
      ), f"objective {objective} not found, supported objective: {list(OBJECTIVE.keys())}"
  
      obj_class = OBJECTIVE[objective]
      if objective == MULTI_CE:
          assert (
              class_num is not None and class_num >= 3
          ), "class_num should be set and greater than 2 for multi:ce objective, but got {}".format(
              class_num
          )
          loss_func = obj_class(class_num=class_num)
      else:
          loss_func = obj_class()
      return loss_func
  
imports: import numpy
  import pandas
  from typing import Optional, Union
  from fate.arch import Context
  from fate.arch.dataframe import DataFrame
  from fate.ml.ensemble.algo.secureboost.hetero._base import HeteroBoostingTree
  from fate.ml.ensemble.learner.decision_tree.hetero.guest import HeteroDecisionTreeGuest
  from fate.ml.ensemble.utils.binning import binning
  from fate.ml.ensemble.learner.decision_tree.tree_core.loss import OBJECTIVE, get_task_info, MULTI_CE, BINARY_BCE, REGRESSION_L2
  from fate.ml.ensemble.algo.secureboost.common.predict import predict_leaf_guest
  from fate.ml.utils.predict_tools import compute_predict_details, PREDICT_SCORE, BINARY, MULTI, REGRESSION
  from fate.ml.ensemble.learner.decision_tree.tree_core.decision_tree import GUEST_FEAT_ONLY, ALL_FEAT
  from fate.ml.ensemble.utils.sample import goss_sample
  import logging
label_desc: Use image node_id 2 for calling a global function with example usage: _get_loss_func(objective, class_num) and returns: loss_func