TFN (Australian Tax File Number).

The Tax File Number (TFN) is issued by the Australian Taxation Office (ATO) to taxpaying individuals and organisations. A business has both a TFN and an Australian Business Number (ABN).

The number consists of 8 (older numbers) or 9 digits and includes a check digit but otherwise without structure.

More information:

>>> validate('123 456 782')
>>> validate('999 999 999')
Traceback (most recent call last):
InvalidChecksum: ...
>>> format('123456782')
'123 456 782'

Calculate the checksum.

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

Reformat the number to the standard presentation format.

Check if the number is a valid TFN.

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