def vat_number_check_digit(vat_number):
 normalized_vat_number = smart_text(vat_number).zfill(10)
 total = 0
 for i in range(0, 10, 2):
  total += int(normalized_vat_number[i])
 for i in range(1, 11, 2):
  (quotient, remainder) = divmod((int(normalized_vat_number[i]) * 2), 10)
  total += (quotient + remainder)
 return smart_text(((10 - (total % 10)) % 10))

def vat_number_check_digit ( vat_number ) : normalized_vat_number = smart_text ( vat_number ) . zfill ( 10 ) total = 0 for i in range ( 0 , 10 , 2 ) : total += int ( normalized_vat_number [ i ] ) for i in range ( 1 , 11 , 2 ) : ( quotient , remainder ) = divmod ( ( int ( normalized_vat_number [ i ] ) * 2 ) , 10 ) total += ( quotient + remainder ) return smart_text ( ( ( 10 - ( total % 10 ) ) % 10 ) )
calculate italian vat number check digit .