code: 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
docs: This function converts the six.moves.input values to integers. It handles
      invalid entries, and optionally forbids values of zero.