def write(response, file, chunk_size=8192):
    """
    Load the data from the http request and save it to disk
    :param response: data returned from the server
    :param file:
    :param chunk_size: size chunk size of the data
    :return:
    """
    bytes_written = 0
    while 1:
        chunk = response.read(chunk_size)
        bytes_written += len(chunk)
        if not chunk:
            break
        file.write(chunk)
    return bytes_written
