def env(key, default):
value = os.environ.get(key, None)<EOL>if value is not None:<EOL><INDENT>log.info('<STR_LIT>', key.lower().replace('<STR_LIT:_>', '<STR_LIT:.>'), value)<EOL>return value<EOL><DEDENT>key = key.lower().replace('<STR_LIT:_>', '<STR_LIT:.>')<EOL>value = get(key)<EOL>if value is not None:<EOL><INDENT>return value<EOL><DEDENT>return default<EOL>
Helper to try to get a setting from the environment, or pyconfig, or
finally use a provided default.