docs: def _prediction_feature_weights(booster, dmatrix, n_targets,
                                  feature_names, xgb_feature_names):
      """ For each target, return score and numpy array with feature weights
      on this prediction, following an idea from
      http://blog.datadive.net/interpreting-random-forests/
      """
      # XGBClassifier does not have pred_leaf argument, so use booster
      leaf_ids, = booster.predict(dmatrix, pred_leaf=True)
      xgb_feature_names = {f: i for i, f in enumerate(xgb_feature_names)}
      tree_dumps = booster.get_dump(with_stats=True)
      assert len(tree_dumps) == len(leaf_ids)
  
      target_feature_weights = partial(
          _target_feature_weights,
          feature_names=feature_names, xgb_feature_names=xgb_feature_names)
      if n_targets > 1:
          # For multiclass, XGBoost stores dumps and leaf_ids in a 1d array,
          # so we need to split them.
          scores_weights = [
              target_feature_weights(
                  leaf_ids[target_idx::n_targets],
                  tree_dumps[target_idx::n_targets],
              ) for target_idx in range(n_targets)]
      else:
          scores_weights = [target_feature_weights(leaf_ids, tree_dumps)]
      return scores_weights