stdnum.gb.utr

UTR (United Kingdom Unique Taxpayer Reference).

A UTR (unique taxpayer reference) is a 10 digit number used to identify UK taxpayers who have to submit a tax return.

More information:

>>> validate('1955839661')
'1955839661'
>>> validate('2955839661')
Traceback (most recent call last):
    ...
InvalidChecksum: ..
stdnum.gb.utr.calc_check_digit(number: str) str

Calculate the check digit for the number. The passed number should not have the check digit (the first one) included.

stdnum.gb.utr.compact(number: str) str

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

stdnum.gb.utr.is_valid(number: str) bool

Check if the number is a valid UTR.

stdnum.gb.utr.validate(number: str) str

Check if the number is a valid UTR.