code: def get_int(value, default, test_fn=None):
      
      try:
          converted = int(value)
      except ValueError:
          return default
  
      test_fn = test_fn if test_fn else lambda x: True
      return converted if test_fn(converted) else default
docs: Convert value to integer.
  
      :param value: Integer value.
      :param default: Default value on failed conversion.
      :param test_fn: Constraint function. Use default if returns ``False``.
      :return: Integer value.
      :rtype:  ``int``