def luhn_residue(digits):
    """ Lunh10 residue value """
s = sum(d if n % 2 == 1 else (0, 2, 4, 6, 8, 1, 3, 5, 7, 9)[d] for n, d in
    enumerate(map(int, reversed(digits))))
return (10 - s % 10) % 10
Generate IMEI in python