stdnum.is_.kennitala

Kennitala (Icelandic personal and organisation identity code).

Module for handling Icelandic personal and organisation identity codes (kennitala).

>>> validate('450401-3150')  # organisation
'4504013150'
>>> validate('120174-3399')  # individual
'1201743399'
>>> validate('530575-0299')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('320174-3399')
Traceback (most recent call last):
    ...
InvalidComponent: ...
>>> format('1201743399')
'120174-3399'
stdnum.is_.kennitala.checksum(number)

Calculate the checksum.

stdnum.is_.kennitala.compact(number)

Convert the kennitala to the minimal representation. This strips surrounding whitespace and separation dash, and converts it to upper case.

stdnum.is_.kennitala.format(number)

Reformat the number to the standard presentation format.

stdnum.is_.kennitala.is_valid(number)

Check if the number provided is a valid HETU. It checks the format, whether a valid date is given and whether the check digit is correct.

stdnum.is_.kennitala.validate(number)

Check if the number provided is a valid kennitala. It checks the format, whether a valid date is given and whether the check digit is correct.