# stdnum.cz.dic

DIČ (Daňové identifikační číslo, Czech VAT number).

The number is an 8, 9 or 10 digit code that includes a check digit and is used to uniquely identify taxpayers for VAT (DPH in Czech). The number can refer to legal entities (8 digit numbers), individuals with a RČ (the 9 or 10 digit Czech birth number) or individuals without a RČ (9 digit numbers that begin with a 6).

    >>> compact('CZ 25123891')
    '25123891'
    >>> validate('25123891')  # legal entity
    '25123891'
    >>> validate('25123890')  # incorrect check digit
    Traceback (most recent call last):
        ...
    InvalidChecksum: ...
    >>> validate('7103192745')  # RČ
    '7103192745'
    >>> validate('640903926')  # special case
    '640903926'

stdnum.cz.dic.calc_check_digit_legal(number)

  Calculate the check digit for 8 digit legal entities. The number passed should not have the check digit included.

stdnum.cz.dic.calc_check_digit_special(number)

  Calculate the check digit for special cases. The number passed should not have the first and last digits included.

stdnum.cz.dic.compact(number)

  Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.

stdnum.cz.dic.is_valid(number)

  Check if the number is a valid VAT number.

stdnum.cz.dic.validate(number)

  Check if the number is a valid VAT number. This checks the length, formatting and check digit.