'Download backup file from WebDAV (cloud only).'

def backup_download(self, filename=None):

    if (self.deploymentType != u'Cloud'):
        logging.warning(u'This    functionality    is    not    available    in    Server    version')
        return None
    remote_file = self.backup_progress()[u'fileName']
    local_file = (filename or remote_file)
    url = ((self._options[u'server'] + u'/webdav/backupmanager/') + remote_file)
    try:
        logging.debug((u'Writing    file    to    %s' % local_file))
        with open(local_file, u'wb') as file:
            try:
                resp = self._session.get(url, headers=self._options[u'headers'], stream=True)
            except Exception:
                raise JIRAError()
            if (not resp.ok):
                logging.error((u'Something    went    wrong    with    download:    %s' % resp.text))
                raise JIRAError(resp.text)
            for block in resp.iter_content(1024):
                file.write(block)
    except JIRAError as je:
        logging.error((u'Unable    to    access    remote    backup    file:    %s' % je))
    except IOError as ioe:
        logging.error(ioe)
    return None
