def if_affirmative(needle: str):
    """
    Returns True if needle is an affirmative string, False otherwise.
    """
    assert isinstance(needle, str)
    needle = needle.strip().lower()
    return needle in {"true", "yes", "1", "ok"}