#NEWLINE# def luhn_checksum_is_valid( self , number ) : #NEWLINE# #INDENT# '\n        Checks to make sure that the SIN passes a luhn mod-10 checksum\n        See: http://en.wikipedia.org/wiki/Luhn_algorithm\n        ' #NEWLINE# sum = 0 #NEWLINE# num_digits = len ( number ) #NEWLINE# oddeven = ( num_digits & 1 ) #NEWLINE# for count in range ( 0 , num_digits ) : #NEWLINE# #INDENT# digit = int ( number [ count ] ) #NEWLINE# if ( not ( ( count & 1 ) ^ oddeven ) ) : #NEWLINE# #INDENT# digit = ( digit * 2 ) #NEWLINE# #UNINDENT# if ( digit > 9 ) : #NEWLINE# #INDENT# digit = ( digit - 9 ) #NEWLINE# #UNINDENT# sum = ( sum + digit ) #NEWLINE# #UNINDENT# return ( ( sum % 10 ) == 0 )