code: def perform_bootstrap_test(estimate, simulations: List):
      # This calculates a two-sided percentile p-value
      # See footnotes in https://journals.sagepub.com/doi/full/10.1177/2515245920911881
      half_p_value = np.mean(
          [
              (x > estimate.value) + 0.5 * (x == estimate.value)
              for x in simulations
          ]
      )
      return 2 * min(half_p_value, 1 - half_p_value)
  
imports: import logging
  import random
  from enum import Enum
  from typing import List, Union
  import numpy
  import scipy.stats
  from dowhy.utils.api import parse_state
label_desc: Use image node_id 2 for calling a global function with example usage: perform_bootstrap_test(estimate, simulations) and returns: unknown