stdnum.ad.nrt

NRT (Número de Registre Tributari, Andorra tax number).

The Número de Registre Tributari (NRT) is an identifier of legal and natural entities for tax purposes.

This number consists of one letter indicating the type of entity, then 6 digits, followed by a check letter.

More information:

>>> validate('U-132950-X')
'U132950X'
>>> validate('A123B')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> validate('I 706193 G')
Traceback (most recent call last):
    ...
InvalidComponent: ...
>>> format('D059888N')
'D-059888-N'
stdnum.ad.nrt.compact(number)

Convert the number to the minimal representation.

This strips the number of any valid separators and removes surrounding whitespace.

stdnum.ad.nrt.format(number)

Reformat the number to the standard presentation format.

stdnum.ad.nrt.is_valid(number)

Check if the number is a valid Andorra NRT number.

stdnum.ad.nrt.validate(number)

Check if the number is a valid Andorra NRT number.

This checks the length, formatting and other constraints. It does not check for control letter.