stdnum.ru.inn

ИНН (Идентификационный номер налогоплательщика, Russian tax identifier).

The Indentifikatzionny nomer nalogoplatel’shchika is a Russian tax identification number that consists 10 digits for companies and 12 digits for persons.

>>> validate('123456789047')
'123456789047'
>>> validate('1234567894')
'1234567894'
>>> validate('123456789037')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('1234567895')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
stdnum.ru.inn.calc_company_check_digit(number)

Calculate the check digit for the 10-digit ИНН for organisations.

stdnum.ru.inn.calc_personal_check_digits(number)

Calculate the check digits for the 12-digit personal ИНН.

stdnum.ru.inn.compact(number)

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

stdnum.ru.inn.is_valid(number)

Check if the number is a valid ИНН.

stdnum.ru.inn.validate(number)

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