code: def _objective_decorator(func):
      
      def inner(preds, dmatrix):
          """internal function"""
          labels = dmatrix.get_label()
          return func(labels, preds)
      return inner
docs: Decorate an objective function
  
      Converts an objective function using the typical sklearn metrics
      signature so that it is usable with ``xgboost.training.train``
  
      Parameters
      ----------
      func: callable
          Expects a callable with signature ``func(y_true, y_pred)``:
  
          y_true: array_like of shape [n_samples]
              The target values
          y_pred: array_like of shape [n_samples]
              The predicted values
  
      Returns
      -------
      new_func: callable
          The new objective function as expected by ``xgboost.training.train``.
          The signature is ``new_func(preds, dmatrix)``:
  
          preds: array_like, shape [n_samples]
              The predicted values
          dmatrix: ``DMatrix``
              The training set from which the labels will be extracted using
              ``dmatrix.get_label()``