code: def download_and_write_file(
      url: str,
      output_path: str,
      session: requests.Session = None,
      retry_fn: Callable = utils.retry,
      request_kwargs: Optional[Dict] = None,
  ) -> None:
      """Downloads a file from a url and saves it to disk
  
      Args:
          url:
              Url of the file to download.
          output_path:
              Where to store the file, including filename and extension.
          session:
              Session object to persist certain parameters across requests.
          retry_fn:
              Retry function that handles failed downloads.
          request_kwargs:
              Additional parameters passed to requests.get().
      """
      request_kwargs = request_kwargs or {}
      request_kwargs.setdefault("stream", True)
      request_kwargs.setdefault("timeout", 10)
      req = requests if session is None else session
      out_path = pathlib.Path(output_path)
      out_path.parent.mkdir(parents=True, exist_ok=True)
      with retry_fn(req.get, url=url, **request_kwargs) as response:
          response.raise_for_status()
          with open(out_path, "wb") as file:
              shutil.copyfileobj(response.raw, file)
  
file_path: lightly/lightly/api/download.py
imports: import concurrent.futures
  import os
  import pathlib
  import shutil
  import threading
  import warnings
  from concurrent.futures import ThreadPoolExecutor
  from typing import Callable, Dict, Iterable, List, Optional, Tuple, Type, Union
  import PIL
  import requests
  import tqdm
  from lightly.api import utils
label_desc: Use image node_id 3 for calling a global function with example usage: download_and_write_file(url, output_path, session, retry_fn, request_kwargs) without return types