def download_file(s, url, data_dir):
    """
    Download the provided file and place it in data_dir
    """
    local_filename = data_dir + url.split('/')[-1]
    # NOTE the stream=True parameter
    req = s.get(url, stream=True)
    with open(local_filename, 'wb') as local_f:
        for chunk in req.iter_content(chunk_size=128*1024):
            if chunk: # filter out keep-alive new chunks
                local_f.write(chunk)
                local_f.flush()
    return local_filename