Use `os.path.splitext` to check file extensions.