code: def feature_importance(self, importance_type='split', iteration=None):
          
          if iteration is None:
              iteration = self.best_iteration
          if importance_type == "split":
              importance_type_int = 0
          elif importance_type == "gain":
              importance_type_int = 1
          else:
              importance_type_int = -1
          result = np.zeros(self.num_feature(), dtype=np.float64)
          _safe_call(_LIB.LGBM_BoosterFeatureImportance(
              self.handle,
              ctypes.c_int(iteration),
              ctypes.c_int(importance_type_int),
              result.ctypes.data_as(ctypes.POINTER(ctypes.c_double))))
          if importance_type_int == 0:
              return result.astype(int)
          else:
              return result
docs: Get feature importances.
  
          Parameters
          ----------
          importance_type : string, optional (default="split")
              How the importance is calculated.
              If "split", result contains numbers of times the feature is used in a model.
              If "gain", result contains total gains of splits which use the feature.
          iteration : int or None, optional (default=None)
              Limit number of iterations in the feature importance calculation.
              If None, if the best iteration exists, it is used; otherwise, all trees are used.
              If <= 0, all trees are used (no limits).
  
          Returns
          -------
          result : numpy array
              Array with feature importances.