def quantize_tstamp(ts): return ts.quantize(decimal.Decimal('0.000001'),rounding=decimal.ROUND_HALF_UP)