code: def get_web_driver_device_pixel_ratio(web_driver: WebDriver) -> float:
      calculate_web_driver_device_pixel_ratio = """\
          return window.devicePixelRatio
      """
      device_pixel_ratio: float = web_driver.execute_script(
          calculate_web_driver_device_pixel_ratio
      )
      return device_pixel_ratio
  
imports: from __future__ import annotations
  import logging
  from ..util.dependencies import import_required
  import atexit
  import os
  from os.path import devnull
  from shutil import which
  from typing import TYPE_CHECKING, Literal
  from packaging.version import Version
  from ..settings import settings
label_desc: Use image node_id 4 for calling a global function with example usage: get_web_driver_device_pixel_ratio(web_driver) and returns: device_pixel_ratio