stdnum.us.ein

EIN (U.S. Employer Identification Number).

The Employer Identification Number, also known as Federal Employer Identification Number (FEIN), is used to identify a business entity in the United States. It is issued to anyone that has to pay withholding taxes on employees.

>>> validate('91-1144442')
'911144442'
>>> get_campus('04-2103594') == 'Brookhaven'
True
>>> validate('911-14-4442')  # dash in the wrong place
Traceback (most recent call last):
    ...
InvalidFormat: ...
>>> validate('07-1144442')  # wrong prefix
Traceback (most recent call last):
    ...
InvalidComponent: ...
>>> format('042103594')
'04-2103594'
>>> format('123')  # unknown formatting is left alone
'123'
stdnum.us.ein.compact(number)

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

stdnum.us.ein.format(number)

Reformat the number to the standard presentation format.

stdnum.us.ein.get_campus(number)

Determine the Campus or other location that issued the EIN.

stdnum.us.ein.is_valid(number)

Check if the number is a valid EIN.

stdnum.us.ein.validate(number)

Check if the number is a valid EIN. This checks the length, groups and formatting if it is present.