NHS (United Kingdom National Health Service patient identifier).

The NHS number is used by the NHS (National Health Service) and its partners to uniquely identify patients. The number is used in England, Wales and the Isle of Man. The number is assigned at birth and consists of 10 digits where the final digit is a check digit.

More information:

>>> validate('943-476-5870')
>>> validate('9434765871')  # invalid check digit
Traceback (most recent call last):
InvalidChecksum: ...
>>> format('9434765870')
'943 476 5870'

Calculate the checksum. The checksum is only used for the 9 digits of the number and the result can either be 0 or 42.

Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace., separator=' ')

Reformat the number to the standard presentation format.

Check if the number is valid.

Check if the number is valid. This checks the length and check digit.