def asymmetric_round_price_to_penny(price, prefer_round_down, diff=(0.0095 - 0.005)):
 epsilon = (float_info.epsilon * 10)
 diff = (diff - epsilon)
 rounded = round((price - (diff if prefer_round_down else (- diff))), 2)
 if zp_math.tolerant_equals(rounded, 0.0):
  return 0.0
 return rounded

def asymmetric_round_price_to_penny ( price , prefer_round_down , diff = ( 0.0095 - 0.005 ) ) : epsilon = ( float_info . epsilon * 10 ) diff = ( diff - epsilon ) rounded = round ( ( price - ( diff if prefer_round_down else ( - diff ) ) ) , 2 ) if zp_math . tolerant_equals ( rounded , 0.0 ) : return 0.0 return rounded
asymmetric rounding function for adjusting prices to two places in a way that "improves" the price .