stdnum.fi.ytunnus

Y-tunnus (Finnish business identifier).

The number is an 8-digit code with a weighted checksum.

>>> validate('2077474-0')
'20774740'
>>> validate('2077474-1')  # invalid check digit
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> format('2077474-0')
'2077474-0'
stdnum.fi.ytunnus.compact(number)

Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.

stdnum.fi.ytunnus.format(number)

Reformat the number to the standard presentation format.

stdnum.fi.ytunnus.is_valid(number)

Check if the number is a valid business identifier.

stdnum.fi.ytunnus.validate(number)

Check if the number is a valid business identifier. This checks the length, formatting and check digit.