import decimal


def remove_exponent(d: decimal.Decimal) -> decimal.Decimal:
    """
    Util function for removing the exponent and trailing zeroes of a decimal.

    From https://docs.python.org/3/library/decimal.html#decimal-faq
    """
    return d.quantize(decimal.Decimal(1)) if d == d.to_integral() else d.normalize()