#NEWLINE# @ classmethod #NEWLINE# def _generate_number( cls , prefix , length ) : #NEWLINE# #INDENT# "\n        'prefix' is the start of the CC number as a string, any number of digits.\n        'length' is the length of the CC number to generate. Typically 13 or 16\n        " #NEWLINE# number = prefix #NEWLINE# number += ( '#' * ( ( length - len ( prefix ) ) - 1 ) ) #NEWLINE# number = cls . numerify ( number ) #NEWLINE# reverse = number [ : : ( - 1 ) ] #NEWLINE# tot = 0 #NEWLINE# pos = 0 #NEWLINE# while ( pos < ( length - 1 ) ) : #NEWLINE# #INDENT# tot += Provider . luhn_lookup [ reverse [ pos ] ] #NEWLINE# if ( pos != ( length - 2 ) ) : #NEWLINE# #INDENT# tot += int ( reverse [ ( pos + 1 ) ] ) #NEWLINE# #UNINDENT# pos += 2 #NEWLINE# #UNINDENT# check_digit = ( ( 10 - ( prefix % 10 ) ) % 10 ) #NEWLINE# number += str ( check_digit ) #NEWLINE# return number