# stdnum.nl.identiteitskaartnummer

Identiteitskaartnummer, Paspoortnummer (the Dutch passport number).

Each Dutch passport has an unique number of 9 alphanumerical characters. The first 2 characters are always letters and the last character is a number. The 6 characters in between can be either.

The letter “O” is never used to prevent it from being confused with the number “0”. Zeros are allowed, but are not used in numbers issued after December 2019.

More information:

- https://www.rvig.nl/node/356

- https://nl.wikipedia.org/wiki/Paspoort#Nederlands_paspoort

    >>> compact('EM0000000')
    'EM0000000'
    >>> compact('XR 1001R5 8')
    'XR1001R58'
    >>> validate('EM0000000')
    'EM0000000'
    >>> validate('XR1001R58')
    'XR1001R58'
    >>> validate('XR1001R')
    Traceback (most recent call last):
        ...
    InvalidLength: ...
    >>> validate('581001RXR')
    Traceback (most recent call last):
        ...
    InvalidFormat: ...
    >>> validate('XR1O01R58')
    Traceback (most recent call last):
        ...
    InvalidComponent: ...

stdnum.nl.identiteitskaartnummer.compact(number: str) → str

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

stdnum.nl.identiteitskaartnummer.is_valid(number: str) → bool

  Check if the number is a valid Dutch passport number.

stdnum.nl.identiteitskaartnummer.validate(number: str) → str

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