code: def holm(pvals, alpha=.05):
      pvals = np.asarray(pvals)
      shape_init = pvals.shape
      pvals = pvals.ravel()
      num_nan = np.isnan(pvals).sum()
      pvals_sortind = np.argsort(pvals)
      pvals_sorted = pvals[pvals_sortind]
      sortrevind = pvals_sortind.argsort()
      ntests = pvals.size - num_nan
      pvals_corr = np.diag(pvals_sorted * np.arange(ntests, 0, -1)[..., None])
      pvals_corr = np.maximum.accumulate(pvals_corr)
      pvals_corr = np.clip(pvals_corr, None, 1)
      pvals_corr = np.append(pvals_corr, np.full(num_nan, np.nan))
      pvals_corrected = pvals_corr[sortrevind].reshape(shape_init)
      with np.errstate(invalid='ignore'):
          reject = np.less(pvals_corrected, alpha)
      return reject, pvals_corrected