'Downloads `entry` by using `url`.
:raises: Several types of exceptions ...
:raises: PluginWarning'

def download_entry(self, task, entry, url, tmp_path):

    log.debug(u"Downloading    url    '%s'", url)
    auth = None
    if (u'download_auth' in entry):
        auth = entry[u'download_auth']
        log.debug(u'Custom    auth    enabled    for    %s    download:    %s', entry[u'title'], entry[u'download_auth'])
    try:
        response = task.requests.get(url, auth=auth, raise_status=False)
    except UnicodeError:
        log.error(u'Unicode    error    while    encoding    url    %s', url)
        return
    if (response.status_code != 200):
        log.debug(u'Got    %s    response    from    server.    Saving    error    page.', response.status_code)
        if response.content:
            self.save_error_page(entry, task, response.content)
        response.raise_for_status()
        return
    try:
        tmp_path = os.path.expanduser(tmp_path)
    except RenderError as e:
        entry.fail((u'Could    not    set    temp    path.    Error    during    string    replacement:    %s' % e))
        return
    tmp_path = pathscrub(tmp_path)
    if (not os.path.isdir(tmp_path)):
        log.debug((u'creating    tmp_path    %s' % tmp_path))
        os.mkdir(tmp_path)
    if (not os.access(tmp_path, os.W_OK)):
        raise plugin.PluginError((u'Not    allowed    to    write    to    temp    directory    `%s`' % tmp_path))
    tmp_dir = tempfile.mkdtemp(dir=tmp_path)
    fname = hashlib.md5(url.encode(u'utf-8', u'replace')).hexdigest()
    datafile = os.path.join(tmp_dir, fname)
    outfile = io.open(datafile, u'wb')
    try:
        for chunk in response.iter_content(chunk_size=(150 * 1024), decode_unicode=False):
            outfile.write(chunk)
    except Exception as e:
        outfile.close()
        log.debug(u'Download    interrupted,    removing    datafile')
        os.remove(datafile)
        if isinstance(e, socket.timeout):
            log.error(u'Timeout    while    downloading    file')
        else:
            raise
    else:
        outfile.close()
        if (os.path.getsize(datafile) == 0):
            entry.fail((u'File    %s    is    0    bytes    in    size' % datafile))
            os.remove(datafile)
            return
        entry[u'file'] = datafile
        log.debug(u'%s    field    file    set    to:    %s', entry[u'title'], entry[u'file'])
    if (u'content-type' in response.headers):
        entry[u'mime-type'] = str(parse_header(response.headers[u'content-type'])[0])
    else:
        entry[u'mime-type'] = u'unknown/unknown'
    content_encoding = response.headers.get(u'content-encoding', u'')
    decompress = ((u'gzip' in content_encoding) or (u'deflate' in content_encoding))
    if ((u'content-length' in response.headers) and (not decompress)):
        entry[u'content-length'] = int(response.headers[u'content-length'])
    if entry.get(u'content-disposition', True):
        self.filename_from_headers(entry, response)
    else:
        log.info(u'Content-disposition    disabled    for    %s', entry[u'title'])
    self.filename_ext_from_mime(entry)
    if (not entry.get(u'filename')):
        filename = unquote(url.rsplit(u'/', 1)[1])
        log.debug(u'No    filename    -    setting    from    url:    %s', filename)
        entry[u'filename'] = filename
    log.debug(u'Finishing    download_entry()    with    filename    %s', entry.get(u'filename'))
