BSN (Burgerservicenummer, Dutch national identification number).

The BSN is a unique personal identifier and has been introduced as the successor to the sofinummer. The number consists of up to 9 digits (the leading 0’s are commonly left out) and contains a simple checksum.

More information:

>>> validate('1112.22.333')
>>> validate('1112.52.333')
Traceback (most recent call last):
InvalidChecksum: ...
>>> validate('1112223334')
Traceback (most recent call last):
InvalidLength: ...
>>> format('111222333')

Calculate the checksum over the number. A valid number should have a checksum of 0.

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

Reformat the passed number to the standard presentation format.

Check if the number is a valid BSN.

Check if the number is a valid BSN. This checks the length and whether the check digit is correct.