def as_int(n):
 try:
  result = int(n)
  if (result != n):
   raise TypeError
 except TypeError:
  raise ValueError(('%s is not an integer' % (n,)))
 return result

def as_int ( n ) : try : result = int ( n ) if ( result != n ) : raise TypeError except TypeError : raise ValueError ( ( '%s is not an integer' % ( n , ) ) ) return result
convert the argument to a builtin integer .