def _get_checked_path(path, config, must_exist=True, allow_none=True):
if path in (None, "<STR_LIT>"):<EOL><INDENT>if allow_none:<EOL><INDENT>return None<EOL><DEDENT>raise ValueError("<STR_LIT>".format(path))<EOL><DEDENT>config_file = config.get("<STR_LIT>")<EOL>if config_file and not os.path.isabs(path):<EOL><INDENT>path = os.path.normpath(os.path.join(os.path.dirname(config_file), path))<EOL><DEDENT>else:<EOL><INDENT>path = os.path.abspath(path)<EOL><DEDENT>if must_exist and not os.path.exists(path):<EOL><INDENT>raise ValueError("<STR_LIT>".format(path))<EOL><DEDENT>return path<EOL>
Convert path to absolute if not None.