# stdnum.eu.eic

EIC (European Energy Identification Code).

The EIC (Energy Identification Code) a 16 character code used in Europe to uniquely identify entities and objects in the electricity and gas sector.

The number uses letters, digits and the minus sign. The first 2 character identify the issuing office, 1 character for the object type, 12 digits for the object and 1 check character.

More information:

- https://en.wikipedia.org/wiki/Energy_Identification_Code

- https://www.entsoe.eu/data/energy-identification-codes-eic/

    >>> validate('22XWATTPLUS----G')
    '22XWATTPLUS----G'
    >>> validate('22XWATTPLUS----X')
    Traceback (most recent call last):
        ...
    InvalidChecksum: ...
    >>> validate('23X--130302DLGW-')  # check digit cannot be minus
    Traceback (most recent call last):
        ...
    InvalidFormat: ...

stdnum.eu.eic.calc_check_digit(number: str) → str

  Calculate the check digit for the number.

stdnum.eu.eic.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.eu.eic.is_valid(number: str) → bool

  Check if the number is valid. This checks the length, format and check digit.

stdnum.eu.eic.validate(number: str) → str

  Check if the number is valid. This checks the length, format and check digit.