def mod10r(number):
 codec = [0, 9, 4, 6, 8, 2, 7, 1, 3, 5]
 report = 0
 result = ''
 for digit in number:
  result += digit
  if digit.isdigit():
   report = codec[((int(digit) + report) % 10)]
 return (result + str(((10 - report) % 10)))

def mod10r ( number ) : codec = [ 0 , 9 , 4 , 6 , 8 , 2 , 7 , 1 , 3 , 5 ] report = 0 result = '' for digit in number : result += digit if digit . isdigit ( ) : report = codec [ ( ( int ( digit ) + report ) % 10 ) ] return ( result + str ( ( ( 10 - report ) % 10 ) ) )
input number : account or invoice number output return: the same number completed with the recursive mod10 key .