MEID (Mobile Equipment Identifier).

The Mobile Equipment Identifier is used to identify a physical piece of CDMA mobile station equipment.

>>> validate('AF 01 23 45 0A BC DE C')
>>> validate('29360 87365 0070 3710 0')
>>> validate('29360 87365 0070 3710 0', strip_check_digit=False)
>>> validate('29360 87365 0070 3710 1')
Traceback (most recent call last):
InvalidChecksum: ...
>>> format('af0123450abcDEC', add_check_digit=True)
'AF 01 23 45 0A BC DE C'
>>> format('af0123450abcDEC', format='dec', add_check_digit=True)
'29360 87365 0070 3710 0'

Calculate the check digit for the number. The number should not already have a check digit.

stdnum.meid.compact(number, strip_check_digit=True)

Convert the MEID number to the minimal (hexadecimal) representation. This strips grouping information, removes surrounding whitespace and converts to hexadecimal if needed. If the check digit is to be preserved and conversion is done a new check digit is recalculated.

stdnum.meid.format(number, separator=' ', format=None, add_check_digit=False)

Reformat the number to the standard presentation format. The separator used can be provided. If the format is specified (either ‘hex’ or ‘dec’) the number is reformatted in that format, otherwise the current representation is kept. If add_check_digit is True a check digit will be added if it is not present yet.


Check if the number is a valid MEID number.


Convert the number to its binary representation (without the check digit).


Convert the provided MEID to a pseudo ESN (pESN). The ESN is returned in compact hexadecimal representation.

stdnum.meid.validate(number, strip_check_digit=True)

Check if the number is a valid MEID number. This converts the representation format of the number (if it is decimal it is not converted to hexadecimal).