def _check_for_int(x):
 try:
  y = int(x)
 except (OverflowError, ValueError):
  pass
 else:
  if ((x == x) and (y == x)):
   return y
 return x

def _check_for_int ( x ) : try : y = int ( x ) except ( OverflowError , ValueError ) : pass else : if ( ( x == x ) and ( y == x ) ) : return y return x
this is a compatibility function that takes a c{float} and converts it to an c{int} if the values are equal .