code: def _chunk_read_(
      response,
      local_file,
      chunk_size=8192,
      report_hook=None,
      initial_size=0,
      total_size=None,
      verbose=1,
  ):
      """Download a file chunk by chunk and show advancement.
  
      Parameters
      ----------
      response : urllib.response.addinfourl
          Response to the download request in order to get file size.
  
      local_file : file
          Hard disk file where data should be written.
  
      chunk_size : int, default=8192
          Size of downloaded chunks.
  
      report_hook : bool, optional
          Whether or not to show downloading advancement. Default: None
  
      initial_size : int, default=0
          If resuming, indicate the initial size of the file.
  
      total_size : int, optional
          Expected final size of download (None means it is unknown).
      %(verbose)s
  
      Returns
      -------
      data : string
          The downloaded file.
  
      """
      try:
          if total_size is None:
              total_size = response.headers.get(
                  "Content-Length"
              ).strip()
          total_size = int(total_size) + initial_size
      except Exception as e:
          if verbose > 2:
              print("Warning: total size could not be determined.")
              if verbose > 3:
                  print(f"Full stack trace: {e}")
          total_size = None
      bytes_so_far = initial_size
  
      t0 = time_last_display = time.time()
      for chunk in response.iter_content(chunk_size):
          bytes_so_far += len(chunk)
          time_last_read = time.time()
          if (
              report_hook
              and
              # Refresh report every second or when download is
              # finished.
              (time_last_read > time_last_display + 1.0 or not chunk)
          ):
              _chunk_report_(bytes_so_far, total_size, initial_size, t0)
              time_last_display = time_last_read
          if chunk:
              local_file.write(chunk)
          else:
              break
  
imports: import collections.abc
  import contextlib
  import fnmatch
  import hashlib
  import os
  import pickle
  import shutil
  import sys
  import tarfile
  import time
  import urllib
  import warnings
  import zipfile
  from pathlib import Path
  import numpy
  import requests
  from .._utils import fill_doc
  from .utils import get_data_dirs
label_desc: Use image node_id 7 for calling a global function with example usage: _chunk_read_(response, local_file, chunk_size, report_hook, initial_size, total_size, verbose) without return types