def validate_yesno(self, value):
    """Validate yes/no responses from a UI."""
    if isinstance(value, bool):
        return value
    normal = value.lower()
    if normal == 'y' or normal == 'yes':
        return True
    if normal == 'n' or normal == 'no':
        return False
    reason = 'Not "yes" or "no".' + str(value)
    raise ValueError(self.msg.format(reason))