def _bool_env(key, default=False):
    """Cast an environment variable to bool

    If unset or empty, return `default`
    `0` is False; all other values are True.
    """
    value = os.environ.get(key, "")
    if value == "":
        return default
    if value.lower() in {"0", "false"}:
        return False
    else:
        return True
Cast an environment variable to bool

If unset or empty, return `default`
`0` is False; all other values are True.
jupyterhub/utils.py