'Callback when a single asset is downloaded.
Args:
url: The original url of the asset as QUrl.
item: The DownloadItem given by the DownloadManager'

def _finished(self, url, item):

    self.pending_downloads.remove((url, item))
    mime = item.raw_headers.get('Content-Type', '')
    mime = mime.decode('iso-8859-1')
    if ((mime.lower() == 'text/css') or url.fileName().endswith('.css')):
        try:
            css_string = item.fileobj.getvalue().decode('utf-8')
        except UnicodeDecodeError:
            log.downloads.warning('Invalid    UTF-8    data    in    {}'.format(url))
            css_string = item.fileobj.getvalue().decode('utf-8', 'ignore')
        import_urls = _get_css_imports(css_string)
        for import_url in import_urls:
            absolute_url = url.resolved(QUrl(import_url))
            self._fetch_url(absolute_url)
    encode = (E_QUOPRI if mime.startswith('text/') else E_BASE64)
    mime = utils.force_encoding(mime, 'ascii')
    self.writer.add_file(urlutils.encoded_url(url), item.fileobj.getvalue(), mime, encode)
    item.fileobj.actual_close()
    if self.pending_downloads:
        return
    self._finish_file()
