def get_or_create_config(path, config):
if os.path.isfile(path):<EOL><INDENT>with open(path) as fh:<EOL><INDENT>_LOG.debug("<STR_LIT>", os.path.abspath(path))<EOL>config._inflate(toml.load(fh))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>os.makedirs(os.path.dirname(path))<EOL><DEDENT>except OSError:<EOL><INDENT>pass<EOL><DEDENT>with open(path, "<STR_LIT:w>") as fh:<EOL><INDENT>toml.dump(config._deflate(), fh)<EOL><DEDENT><DEDENT>
Using TOML format, load config from given path, or write out example based on defaults