stdnum.us.tin

TIN (U.S. Taxpayer Identification Number).

The Taxpayer Identification Number is used used for tax purposes in the United States. A TIN may be: * a Social Security Number (SSN) * an Individual Taxpayer Identification Number (ITIN) * an Employer Identification Number (EIN) * a Preparer Tax Identification Number (PTIN) * an Adoption Taxpayer Identification Number (ATIN)

>>> compact('123-45-6789')
'123456789'
>>> validate('123-45-6789')
'123456789'
>>> validate('07-3456789')
Traceback (most recent call last):
    ...
InvalidFormat: ...
>>> guess_type('536-90-4399')
['ssn', 'atin']
>>> guess_type('04-2103594')
['ein']
>>> guess_type('042103594')
['ssn', 'ein', 'atin']
>>> format('042103594')
'042-10-3594'
>>> format('123-456')  # invalid numbers are not reformatted
'123-456'
stdnum.us.tin.compact(number)

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

stdnum.us.tin.format(number)

Reformat the passed number to the standard format.

stdnum.us.tin.guess_type(number)

Return a list of possible TIN types for which this number is valid..

stdnum.us.tin.is_valid(number)

Checks to see if the number provided is a valid TIN. This searches for the proper sub-type and validates using that.

stdnum.us.tin.validate(number)

Checks to see if the number provided is a valid TIN. This searches for the proper sub-type and validates using that.

Previous topic

stdnum.us.ssn