def _canonical_decimal_round_tiny_exp(n):
    """
    Same behavior as _canonical_decimal, but also accepts small values in
    scientific notation, rounding them to zero

    """
    exp_match = re.match(r'^-?\d.\d+E-(\d)$', n)
    if exp_match:
        e = int(exp_match.group(1))
        if e < 4:
            raise ValueError('Hack for scientific notation only works for '
                             'negative exponents 4 and above: {!r}'.format(n))
        else:
            return Decimal('0')
    else:
        return _canonical_decimal(n)
dataset/ETHPy150Open dimagi/commcare-hq/corehq/ex-submodules/couchforms/jsonobject_extensions.py/_canonical_decimal_round_tiny_exp/original