<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _check_spot_bid(spot_bid, spot_history):
 """ Prevents users from potentially over-paying for instances Note: this checks over the whole region, not a particular zone :param spot_bid: float :type spot_history: list[SpotPriceHistory] :raises UserError: if bid is > 2X the spot price's average FauxHistory( 0.2, "us-west-2a" ), \ FauxHistory( 0.3, "us-west-2b" ), \ FauxHistory( 0.6, "us-west-2b" ) ] Traceback (most recent call last):
 UserError: Your bid $ 2.000000 is more than double this instance type's average spot price ($ 0.300000) over the last week """

    average = mean([datum.price for datum in spot_history])
    if spot_bid > average * 2:
        logger.warn("Your bid $ %f is more than double this instance type's average "
                 "spot price ($ %f) over the last week", spot_bid, average)