(n)
return decimal
raises ValueError for non-canonically formatted decimal strings

    example: '00.1' or '.1' whose canonical form is '0.1'
raises ValueError for non-canonically formatted decimal strings
raises ValueError for non - canonically formatted decimal strings
def _canonical_decimal(n):
    """
    raises ValueError for non-canonically formatted decimal strings

    example: '00.1' or '.1' whose canonical form is '0.1'

    """
    value_error = False
    try:
        decimal = Decimal(n)
    except InvalidOperation:
        value_error = True
    if value_error:
        raise ValueError('{!r} is not a canonically formatted decimal'
                         .format(n))
    return decimal
def _canonical_decimal ( n ) : value_error = False try : decimal = Decimal ( n ) except InvalidOperation : value_error = True if value_error : raise ValueError ( '{!r} is not a canonically formatted decimal' . format ( n ) ) return decimal