def str2bool(v): if type(v) == types.BooleanType: return v return v.lower() in ("yes", "true", "t", "1")