def METHOD_NAME(value, default):
    """Try to convert the value (which is a string) to the type of the default value.
    If (for int and bool) that fails, returns the default, otherwise returns the string unchanged.
    """
    if isinstance(default, bool):
        if value.lower() in ('true', 'yes', 'on', 't', '1'):
            return True
        elif value.lower() in ('false', 'no', 'off', 'f', '0'):
            return False
        return default
    elif isinstance(default, int):
        try:
            return int(value)
        except ValueError:
            return default
    return value