code: def construct_time_based_gas_price_strategy(max_wait_seconds,
                                              sample_size=120,
                                              probability=98):
      
      def time_based_gas_price_strategy(web3, transaction_params):
          avg_block_time = _get_avg_block_time(web3, sample_size=sample_size)
          wait_blocks = int(math.ceil(max_wait_seconds / avg_block_time))
  
          raw_miner_data = _get_raw_miner_data(web3, sample_size=sample_size)
          miner_data = _aggregate_miner_data(raw_miner_data)
  
          probabilities = _compute_probabilities(
              miner_data,
              wait_blocks=wait_blocks,
              sample_size=sample_size,
          )
  
          gas_price = _compute_gas_price(probabilities, probability / 100)
          return gas_price
      return time_based_gas_price_strategy
docs: A gas pricing strategy that uses recently mined block data to derive a gas
      price for which a transaction is likely to be mined within X seconds with
      probability P.
  
      :param max_wait_seconds: The desired maxiumum number of seconds the
          transaction should take to mine.
      :param sample_size: The number of recent blocks to sample
      :param probability: An integer representation of the desired probability
          that the transaction will be mined within ``max_wait_seconds``.  0 means 0%
          and 100 means 100%.