code: def num_trees(self):
          
          num_trees = ctypes.c_int(0)
          _safe_call(_LIB.LGBM_BoosterNumberOfTotalModel(
              self.handle,
              ctypes.byref(num_trees)))
          return num_trees.value
docs: Get number of weak sub-models.
  
          Returns
          -------
          num_trees : int
              The number of weak sub-models.