stdnum.de.idnr

IdNr (Steuerliche Identifikationsnummer, German personal tax number).

The IdNr (or Steuer-IdNr) is a personal identification number that is assigned to individuals in Germany for tax purposes and is meant to replace the Steuernummer. The number consists of 11 digits and does not embed any personal information.

More information:

>>> validate('36 574 261 809')
'36574261809'
>>> validate('36574261890')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('36554266806')  # more digits repeated
Traceback (most recent call last):
    ...
InvalidFormat: ...
>>> format('36574261809')
'36 574 261 809'
stdnum.de.idnr.compact(number)

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

stdnum.de.idnr.format(number)

Reformat the number to the standard presentation format.

stdnum.de.idnr.is_valid(number)

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

stdnum.de.idnr.validate(number)

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