def env(var_name, default=False):
    """ Get the environment variable. If not found use a default or False, but print to stderr a warning about the missing env variable."""
    try:
        value = os.environ[var_name]
        if str(value).strip().lower() in ['false', 'f', 'no', 'off' '0', 'none', 'null', '', ]:
            return None
        return value
    except:
        from traceback import format_exc
        msg = "Unable to find the %s environment variable.\nUsing the value %s (the default) instead.\n" % (var_name, default)
        sys.stderr.write(format_exc())
        sys.stderr.write(msg)
        return default
Get the environment variable. If not found use a default or False, but print to stderr a warning about the missing env variable.