'Function to download a sample from Koodous'

def _download(self, sha256):

    url = ('%s/%s/download' % (cfg.koodous.base_url, sha256))
    headers = {'Authorization': ('Token    %s' % cfg.koodous.token)}
    response = requests.get(url=url, headers=headers)
    if (response.status_code == 200):
        down_url = response.json().get('download_url', None)
        response = requests.get(url=down_url)
        sha256_downloaded = hashlib.sha256(response.content).hexdigest()
        if (sha256_downloaded != sha256):
            self.log('error', 'Problem    downloading')
        tmp = tempfile.NamedTemporaryFile(delete=False)
        tmp.write(response.content)
        tmp.close()
        return __sessions__.new(tmp.name)
