def safe_int(val, allow_zero=True):
 try:
  ret = int(val)
 except ValueError:
  print(("Sorry, '%s' is not a valid integer." % val))
  return False
 if ((not allow_zero) and (ret == 0)):
  print('Please enter a non-zero integer.')
  return False
 return ret

def safe_int ( val , allow_zero = True ) : try : ret = int ( val ) except ValueError : print ( ( "Sorry, '%s' is not a valid integer." % val ) ) return False if ( ( not allow_zero ) and ( ret == 0 ) ) : print ( 'Please enter a non-zero integer.' ) return False return ret
this function converts the six .