stdnum.ma.ice

ICE (Identifiant Commun de l’Entreprise, التعريف الموحد للمقاولة, Morocco tax number).

The ICE is a number that identifies the company and its branches in a unique and uniform way by all Moroccan administrations. It comes in addition to the other legal identifiers, notably the “identifiant fiscal” (IF), the “numéro de registre de commerce” (RC) and the CNSS number. The ICE does not replace these identifiers, which remain mandatory.

The ICE is intended to ease communication among Moroccan administration branches, therefore simplifying procedures, increasing reliability and speed, and therefore reducing costs.

The ICE applies to legal entities and their branches, as well as to natural persons.

The ICE consists of 15 characters, where the first 9 represent the enterprise, the following 4 represent its establishments, and the last 2 are control characters.

More information:

>>> validate('001561191000066')
'001561191000066'
>>> validate('00 21 36 09 30 00 040')
'002136093000040'
>>> validate('12345')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> validate('001561191000065')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> format('00 21 36 09 30 00 040')
'002136093000040'
stdnum.ma.ice.compact(number)

Convert the number to the minimal representation.

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

stdnum.ma.ice.format(number)

Reformat the number to the standard presentation format.

stdnum.ma.ice.is_valid(number)

Check if the number is a valid Morocco ICE number.

stdnum.ma.ice.validate(number)

Check if the number is a valid Morocco ICE number.

This checks the length and formatting.