I like to keep it simple to read..
This will accept bool, string, number and read it to a bool
def var2bool(v):
if type(v) == type(True):
res = v
elif type(v) == type(0):
if v == 0:
res = False
else:
res = True
elif v.lower() in ("yes", "true", "t", "1"):
res = True
else:
res = False
return res