NIE (Número de Identificación de Extranjeros, Spanish foreigner number).
The NIE is an identification number for foreigners. It is a 9 digit number where the first digit is either X, Y or Z and last digit is a checksum letter.
>>> compact('x-2482300w')
'X2482300W'
>>> is_valid('x-2482300w')
True
>>> is_valid('x-2482300a') # invalid check digit
False
Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.
Checks to see if the number provided is a valid DNI number. This checks the length, formatting and check digit.