Identical to the to_integral_value() method. The to_integral() name has been kept for compatibility with older versions.
>>> def remove_exponent(d): ... return d.quantize(Decimal(1)) if d == d.to_integral() else d.normalize()
decimal/Decimal.to_integral
Decimal.to_integral