# stdnum.fi.hetu

HETU (Henkilötunnus, Finnish personal identity code).

Module for handling Finnish personal identity codes (HETU, Henkilötunnus). See http://www.vaestorekisterikeskus.fi/default.aspx?id=45 for checksum calculation details and http://tarkistusmerkit.teppovuori.fi/tarkmerk.htm#hetu1 for historical details.

    >>> validate('131052-308T')
    '131052-308T'
    >>> validate('131052-308U')
    Traceback (most recent call last):
        ...
    InvalidChecksum: ...
    >>> validate('310252-308Y')
    Traceback (most recent call last):
        ...
    InvalidComponent: ...
    >>> compact('131052a308t')
    '131052A308T'

`stdnum.fi.hetu.``compact`(number)

  Convert the HETU to the minimal representation. This strips surrounding whitespace and converts it to upper case.

`stdnum.fi.hetu.``format`(number)

  Convert the HETU to the minimal representation. This strips surrounding whitespace and converts it to upper case.

`stdnum.fi.hetu.``is_valid`(number)

  Check if the number is a valid HETU.

`stdnum.fi.hetu.``validate`(number)

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