defstr_to_bool(s):ifsisNone:returnFalseassertisinstance(s,str),'given argument must be a string'ifs.lower()in['true','1','yes']:returnTrueelifs.lower()in['false','0','no']:returnFalseelse:raiseLookupError