def validate_output_file(output_filepath):
nowrite_conditions = [<EOL>bool(os.path.dirname(output_filepath)) ornot os.access(os.getcwd(), os.W_OK),<EOL>not os.access(os.path.dirname(output_filepath), os.W_OK)]<EOL>if all(nowrite_conditions):<EOL><INDENT>raise IOError(<EOL>"<STR_LIT>".format(output_filepath)<EOL>)<EOL><DEDENT>ext = file_extension(output_filepath)<EOL>if ext not in VALID_FORMATS:<EOL><INDENT>logger.info("<STR_LIT>", "<STR_LIT:U+0020>".join(VALID_FORMATS))<EOL>logger.warning(<EOL>"<STR_LIT>".format(ext)<EOL>)<EOL><DEDENT>if os.path.exists(output_filepath):<EOL><INDENT>logger.warning(<EOL>'<STR_LIT>',<EOL>output_filepath<EOL>)<EOL><DEDENT>
Output file validation function. Checks that file can be written, and
    has a valid file extension. Throws a warning if the path already exists,
    as it will be overwritten on build.

    Parameters
    ----------
    output_filepath : str
        The output filepath.

    Returns:
    --------
    output_filepath : str
        The output filepath.