code: def try_int(s, default=None, minimum=None):
      
      if not s:
          return default
      try:
          val = int(s)
      except (TypeError, ValueError):
          raise InvalidNumber(s)
      if (minimum is not None) and (val < minimum):
          val = minimum
      return val
docs: Try parsing a string into an integer.
          If None is passed, default is returned.
          On failure, InvalidNumber is raised.