stdnum.imei¶
IMEI (International Mobile Equipment Identity).
The IMEI is used to identify mobile phones. The IMEI may optionally include a check digit which is validated using the Luhn algorithm.
>>> validate('35686800-004141-20')
'3568680000414120'
>>> validate('35-417803-685978-1')
Traceback (most recent call last):
...
InvalidChecksum: ...
>>> compact('35686800-004141-20')
'3568680000414120'
>>> format('354178036859789')
'35-417803-685978-9'
>>> format('35686800-004141', add_check_digit=True)
'35-686800-004141-8'
>>> imei_type('35686800-004141-20')
'IMEISV'
>>> split('35686800-004141')
('35686800', '004141', '')
Traceback (most recent call last):
...
InvalidChecksum: ...
-
stdnum.imei.
compact
(number)¶ Convert the IMEI number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.
-
stdnum.imei.
format
(number, separator='-', add_check_digit=False)¶ Reformat the passed number to the standard format.
-
stdnum.imei.
imei_type
(number)¶ Check the passed number and returns ‘IMEI’, ‘IMEISV’ or None (for invalid) for checking the type of number passed.
-
stdnum.imei.
is_valid
(number)¶ Checks to see if the number provided is a valid IMEI (or IMEISV) number.
-
stdnum.imei.
split
(number)¶ Split the number into a Type Allocation Code (TAC), serial number and either the checksum (for IMEI) or the software version number (for IMEISV).
-
stdnum.imei.
validate
(number)¶ Checks to see if the number provided is a valid IMEI (or IMEISV) number.