def METHOD_NAME(
    r: requests.Response,
    file: IO[bytes],
    chunk_size: int = 2**14,
    progress_bar_min_bytes: int = 2**25,
) -> str:
    """Stream the response to the file, returning the checksum.
    :param progress_bar_min_bytes: Minimum number of bytes to display a progress bar for. Default is 32MB
    """
    # check header to get content length, in bytes
    total_length = int(r.headers.get("content-length", 0))
    md5 = hashlib.md5()
    streamer = r.iter_content(chunk_size=chunk_size)
    display_progress = total_length > progress_bar_min_bytes
    if display_progress:
        progress = _create_progress_bar()
        progress.start()
        task_id = progress.add_task("Downloading", total=total_length)
    for chunk in streamer:  # 16k
        file.write(chunk)
        md5.update(chunk)
        if display_progress:
            progress.update(task_id, advance=len(chunk))  # type: ignore
    if display_progress:
        progress.stop()  # type: ignore
    return md5.hexdigest()