def fetch_image(self, candidate, extra):
        """Downloads an image from a URL and checks whether it seems to
        actually be an image. If so, returns a path to the downloaded image.
        Otherwise, returns None.
        """
        if extra['maxwidth']:
            candidate.url = ArtResizer.shared.proxy_url(extra['maxwidth'],
                                                        candidate.url)
        try:
            with closing(self.request(candidate.url, stream=True,
                                      message=u'downloading image')) as resp:
                if resp.headers not in 'Content-Type' \
                        or resp.headers['Content-Type'] not in CONTENT_TYPES:
                    self._log.debug(
                        u'not a supported image: {}',
                        resp.headers.get('Content-Type') or u'no content type',
                    )
                    candidate.path = None
                    return

                # Generate a temporary file with the correct extension.
                with NamedTemporaryFile(suffix=DOWNLOAD_EXTENSION,
                                        delete=False) as fh:
                    for chunk in resp.iter_content(chunk_size=1024):
                        fh.write(chunk)
                self._log.debug(u'downloaded art to: {0}',
                                util.displayable_path(fh.name))
                candidate.path = fh.name
                return

        except (IOError, requests.RequestException, TypeError) as exc:
            # Handling TypeError works around a urllib3 bug:
            # https://github.com/shazow/urllib3/issues/556
            self._log.debug(u'error fetching art: {}', exc)
            candidate.path = None
            return
dataset/ETHPy150Open beetbox/beets/beetsplug/fetchart.py/RemoteArtSource.fetch_image/swapped operands of `not in`