def valid(number):
checksum = <NUM_LIT:0><EOL>number_len = len(number)<EOL>offset = ord('<STR_LIT:0>')<EOL>i = number_len - <NUM_LIT:1><EOL>while i >= <NUM_LIT:0>:<EOL><INDENT>n = ord(number[i]) - offset<EOL>checksum += n<EOL>i -= <NUM_LIT:2><EOL><DEDENT>i = number_len - <NUM_LIT:2><EOL>while i >= <NUM_LIT:0>:<EOL><INDENT>n = ord(number[i]) - offset<EOL>n *= <NUM_LIT:2><EOL>if n > <NUM_LIT:9>:<EOL><INDENT>n -= <NUM_LIT:9><EOL><DEDENT>checksum += n<EOL>i -= <NUM_LIT:2><EOL><DEDENT>return checksum%<NUM_LIT:10> == <NUM_LIT:0><EOL>
Returns true if the number string is luhn valid, and false otherwise.  The
number string passed to the function must contain only numeric characters
otherwise behavior is undefined.