Converting any nonempty string with bool gives True, even the string 'false'. Interpret text flags by comparing their normalized value with the word you expect.
reply = " DONE "
print(bool("off")) # True: this string contains characters.
print(reply.strip().lower() == "done") # True: its contents match.Use a comparison when the meaning of the word matters. Normalizing first accepts different capitalization.
The text flag is either "yes" or "no", possibly with surrounding spaces or uppercase letters. Assign its normalized lowercase text to answer and its boolean meaning to enabled.