code: def _download_file(
      base_url: str,
      filename: str,
      data_dir: Path,
      progress: bool = True,
  ) -> None:
      # These are actually somewhat expensive imports that added ~5% to overall
      # typical bokeh import times. Since downloading sampledata is not a common
      # action, we defer them to inside this function.
      from zipfile import ZipFile
  
      file_url = urljoin(base_url, filename)
      file_path = data_dir / filename
  
      url = urlopen(file_url)
  
      with open(file_path, "wb") as file:
          file_size = int(url.headers["Content-Length"])
          print(f"Downloading: {filename} ({file_size} bytes)")
  
          fetch_size = 0
          block_size = 16384
  
          while True:
              data = url.read(block_size)
              if not data:
                  break
  
              fetch_size += len(data)
              file.write(data)
  
              if progress:
                  status = f"\r{fetch_size:< 10d} [{fetch_size*100.0/file_size:6.2f}%%]"
                  stdout.write(status)
                  stdout.flush()
  
      if progress:
          print()
  
      real_name, ext = splitext(filename)
  
      if ext == ".zip":
          if not splitext(real_name)[1]:
              real_name += ".csv"
  
          print(f"Unpacking: {real_name}")
  
          with ZipFile(file_path, "r") as zip_file:
              zip_file.extract(real_name, data_dir)
  
          file_path.unlink()
  
imports: from __future__ import annotations
  import hashlib
  import json
  from os.path import splitext
  from pathlib import Path
  from sys import stdout
  from typing import TYPE_CHECKING, Any, TextIO
  from urllib.parse import urljoin
  from urllib.request import urlopen
label_desc: Use image node_id 13 for calling a global function with example usage: _download_file(base_url, filename, data_dir, progress) without return types