stdnum.sm.coe

COE (Codice operatore economico, San Marino national tax number).

The COE is a tax identification number of up to 5-digits used in San Marino. Leading zeroes are commonly dropped.

>>> validate('51')
'51'
>>> validate('024165')
'24165'
>>> validate('2416A')
Traceback (most recent call last):
    ...
InvalidFormat: ...
>>> validate('1124165')
Traceback (most recent call last):
    ...
InvalidLength: ...
stdnum.sm.coe.compact(number)

Convert the number to the minimal representation. This strips surrounding whitespace and separation dash.

stdnum.sm.coe.is_valid(number)

Check if the number is a valid COE.

stdnum.sm.coe.validate(number)

Check if the number is a valid COE. This checks the length and formatting.