code: def update(self, dtrain, iteration, fobj=None):
          
          if not isinstance(dtrain, DMatrix):
              raise TypeError('invalid training matrix: {}'.format(type(dtrain).__name__))
          self._validate_features(dtrain)
  
          if fobj is None:
              _check_call(_LIB.XGBoosterUpdateOneIter(self.handle, iteration, dtrain.handle))
          else:
              pred = self.predict(dtrain)
              grad, hess = fobj(pred, dtrain)
              self.boost(dtrain, grad, hess)
docs: Update for one iteration, with objective function calculated internally.
  
          Parameters
          ----------
          dtrain : DMatrix
              Training data.
          iteration : int
              Current iteration number.
          fobj : function
              Customized objective function.