stdnum.gt.nit

NIT (Número de Identificación Tributaria, Guatemala tax number).

The Número de Identificación Tributaria (NIT) is an identifier of legal entities for tax purposes in Guatemala.

The number consists of 2 to 12 characters, where the last one is the check digit (a digit or the letter K) and the rest are digits. Leading zeroes are usually omitted. Digits and check digit are usually separated with a hyphen.

More information:

>>> validate('576937-K')
'576937K'
>>> validate('7108-0')
'71080'
>>> validate('8977112-0')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('1234567890123')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> format('39525503')
'3952550-3'
stdnum.gt.nit.calc_check_digit(number)

Calculate the check digit. The number passed should not have the check digit included.

stdnum.gt.nit.compact(number)

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

stdnum.gt.nit.format(number)

Reformat the number to the standard presentation format.

stdnum.gt.nit.is_valid(number)

Check if the number is a valid Guatemala NIT number.

stdnum.gt.nit.validate(number)

Check if the number is a valid Guatemala NIT number.

This checks the length, formatting and check digit.