def _check_download_dir(link, download_dir, hashes):<EOL>
download_path = os.path.join(download_dir, link.filename)<EOL>if os.path.exists(download_path):<EOL><INDENT>logger.info('<STR_LIT>', download_path)<EOL>if hashes:<EOL><INDENT>try:<EOL><INDENT>hashes.check_against_path(download_path)<EOL><DEDENT>except HashMismatch:<EOL><INDENT>logger.warning(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>',<EOL>download_path<EOL>)<EOL>os.unlink(download_path)<EOL>return None<EOL><DEDENT><DEDENT>return download_path<EOL><DEDENT>return None<EOL>
Check download_dir for previously downloaded file with correct hash
        If a correct file is found return its path else None