code: def _pval_from_bootci(boot, estimate):
      
      if estimate == 0:
          out = 1
      else:
          out = 2 * min(sum(boot > 0), sum(boot < 0)) / len(boot)
      return min(out, 1)
docs: Compute p-value from bootstrap distribution.
      Similar to the pval function in the R package mediation.
      Note that this is less accurate than a permutation test because the
      bootstrap distribution is not conditioned on a true null hypothesis.