code: def shepherd(x, y, n_boot=200):
      """
      Shepherd's Pi correlation, equivalent to Spearman's rho after outliers
      removal.
  
      Parameters
      ----------
      x, y : array_like
          First and second set of observations. x and y must be independent.
      n_boot : int
          Number of bootstrap samples to calculate.
  
      Returns
      -------
      r : float
          Pi correlation coefficient
      pval : float
          Two-tailed adjusted p-value.
      outliers : array of bool
          Indicate if value is an outlier or not
  
      Notes
      -----
      It first bootstraps the Mahalanobis distances, removes all observations
      with m >= 6 and finally calculates the correlation of the remaining data.
  
      Pi is Spearman's Rho after outlier removal.
      """
      X = np.column_stack((x, y))
      # Bootstrapping on Mahalanobis distance
      m = bsmahal(X, X, n_boot)
      # Determine outliers
      outliers = m >= 6
      # Compute correlation
      r, pval = spearmanr(x[~outliers], y[~outliers])
      # (optional) double the p-value to achieve a nominal false alarm rate
      # pval *= 2
      # pval = 1 if pval > 1 else pval
      return r, pval, outliers
  
imports: import warnings
  import numpy
  import pandas
  import pandas_flavor
  from scipy.spatial.distance import pdist, squareform
  from scipy.stats import pearsonr, spearmanr, kendalltau
  from pingouin.config import options
  from pingouin.power import power_corr
  from pingouin.multicomp import multicomp
  from pingouin.effsize import compute_esci
  from pingouin.utils import remove_na, _perm_pval, _postprocess_dataframe
  from pingouin.bayesian import bayesfactor_pearson
label_desc: Use image node_id 4 for calling a global function with example usage: shepherd(x, y, n_boot) and returns: r,  pval,  outliers