SSN (U.S. Social Security Number).
The Social Security Number is used to identify individuals for taxation purposes.
>>> validate('536-90-4399')
'536904399'
>>> validate('1112-23333') # dash in the wrong place
Traceback (most recent call last):
...
InvalidFormat: ...
>>> validate('666-00-0000') # invalid area
Traceback (most recent call last):
...
InvalidComponent: ...
>>> validate('078-05-1120') # blacklisted entry
Traceback (most recent call last):
...
InvalidComponent: ...
>>> compact('1234-56-789')
'123456789'
>>> format('111223333')
'111-22-3333'
Traceback (most recent call last):
...
InvalidComponent: ...
Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.
Reformat the passed number to the standard format.
Checks to see if the number provided is a valid SSN. This checks the length, groups and formatting if it is present.
Checks to see if the number provided is a valid SSN. This checks the length, groups and formatting if it is present.