# 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:

- https://www.oecd.org/tax/automatic-exchange/crs-implementation-and-assistance/tax-identification-numbers/Andorra-TIN.pdf

    >>> 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: str) → str

  Convert the number to the minimal representation.

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

stdnum.ad.nrt.format(number: str) → str

  Reformat the number to the standard presentation format.

stdnum.ad.nrt.is_valid(number: str) → bool

  Check if the number is a valid Andorra NRT number.

stdnum.ad.nrt.validate(number: str) → str

  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.