code: def frienemy_pruning(X_query, X_dsel, y_dsel, ensemble, k):
      """Implements the Online Pruning method (frienemy) which prunes base
      classifiers that do not cross the region of competence of a given instance.
      A classifier crosses the region of competence if it correctly
      classify at least one sample for each different class in the region.
  
      Parameters
      ----------
      X_query : array-like of shape (n_samples, n_features)
          Test set.
      X_dsel : array-like of shape (n_samples, n_features)
          Dynamic selection set.
      y_dsel : array-like of shape (n_samples,)
          The target values (Dynamic selection set).
      ensemble : list of shape = [n_classifiers]
          The ensemble of classifiers to be pruned.
      k : int
          Number of neighbors used to compute the regions of competence.
  
      Returns
      -------
      DFP_mask : array-like of shape = [n_samples, n_classifiers]
                 Mask containing 1 for the selected base classifier and 0
                 otherwise.
  
      """
      predictions = np.zeros(
          (X_dsel.shape[0], len(ensemble)), dtype=np.intp
      )
      for index, clf in enumerate(ensemble):
          predictions[:, index] = clf.predict(X_dsel)
      hit_miss = predictions == y_dsel[:, np.newaxis]
      competence_region = KNeighborsClassifier(n_neighbors=k).fit(
          X_dsel, y_dsel
      )
      neighbors = competence_region.kneighbors(
          X_query, return_distance=False
      )
      return frienemy_pruning_preprocessed(neighbors, y_dsel, hit_miss)
  
label_desc: Use image node_id 1 for calling a global function with example usage: frienemy_pruning(X_query, X_dsel, y_dsel, ensemble, k) and returns: frienemy_pruning_preprocessed