luhn
Generate and verify Luhn check digits
Install with
pip install luhn
Use verify
to check digit strings
>>> from luhn import *
>>> verify('356938035643809')
True
>>> verify('534618613411236')
False
and use generate
to produce them
>>> generate('53461861341123')
4
or append
for convenience
>>> append('53461861341123')
'534618613411234'