SIRET (a French company establishment identification number).

The SIRET (Système d’Identification du Répertoire des ETablissements) is a 14 digit number used to identify French companies’ establishments and facilities. The Luhn checksum is used to validate the numbers.

>>> validate('73282932000074')
>>> validate('73282932000079')
Traceback (most recent call last):
InvalidChecksum: ...
>>> to_siren('732 829 320 00074')
'732 829 320'
>>> to_siren('73282932000074')
>>> to_tva('732 829 320 00074')
'44 732 829 320'
>>> to_tva('73282932000074')
>>> format('73282932000074')
'732 829 320 00074'

Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace., separator=' ')

Reformat the number to the standard presentation format.

Check if the number is a valid SIRET.

Convert the SIRET number to a SIREN number.

The SIREN number is the 9 first digits of the SIRET number.

Convert the SIRET number to a TVA number.

The TVA number is built from the SIREN number, prepended by two extra error checking digits.

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