code: def get_label_n(y, y_pred, n=None):
      """Function to turn raw outlier scores into binary labels by assign 1
      to top n outlier scores.
  
      Parameters
      ----------
      y : list or numpy array of shape (n_samples,)
          The ground truth. Binary (0: inliers, 1: outliers).
  
      y_pred : list or numpy array of shape (n_samples,)
          The raw outlier scores as returned by a fitted model.
  
      n : int, optional (default=None)
          The number of outliers. if not defined, infer using ground truth.
  
      Returns
      -------
      labels : numpy array of shape (n_samples,)
          binary labels 0: normal points and 1: outliers
  
      Examples
      --------
      >>> from pyod.utils.utility import get_label_n
      >>> y = [0, 1, 1, 0, 0]
      >>> y_pred = [0.1, 0.5, 0.3, 0.2, 0.7]
      >>> get_label_n(y, y_pred)
      array([0, 1, 0, 0, 1])
  
      """
  
      # enforce formats of inputs
      y = column_or_1d(y)
      y_pred = column_or_1d(y_pred)
  
      check_consistent_length(y, y_pred)
      y_len = len(y)  # the length of targets
  
      # calculate the percentage of outliers
      if n is not None:
          outliers_fraction = n / y_len
      else:
          outliers_fraction = np.count_nonzero(y) / y_len
  
      threshold = percentile(y_pred, 100 * (1 - outliers_fraction))
      y_pred = (y_pred > threshold).astype("int")
  
      return y_pred
  
imports: from __future__ import division
  from __future__ import print_function
  import numbers
  import numpy
  import sklearn
  from numpy import percentile
  from sklearn.metrics import precision_score
  from sklearn.preprocessing import StandardScaler
  from sklearn.utils import check_array
  from sklearn.utils import check_consistent_length
  from sklearn.utils import check_random_state
  from sklearn.utils import column_or_1d
  from sklearn.utils.random import sample_without_replacement
label_desc: Use image node_id 6 for calling a global function with example usage: get_label_n(y, y_pred, n) and returns: y_pred