Here's my 2 cents: Why not use YAML?
Code:
import os, yaml
bool(yaml.load(os.getenv(MY_VAR) or "", yaml.Loader))
Test:
for val, expected in {
"yes": True,
"no": False,
"on": True,
"off": False,
"true": True,
"false": False,
"1": True,
"0": False,
"": False,
None: False,
}.items():
actual = bool(yaml.load(val or "", yaml.Loader))
assert actual == expected