code: def verify_image_cache(request, pytestconfig):
      """Checks cached images against test images for PyVista."""
  
      # Set CMD options in class attributes
      VerifyImageCache.reset_image_cache = pytestconfig.getoption(
          "reset_image_cache"
      )
      VerifyImageCache.ignore_image_cache = pytestconfig.getoption(
          "ignore_image_cache"
      )
      VerifyImageCache.fail_extra_image_cache = pytestconfig.getoption(
          "fail_extra_image_cache"
      )
      VerifyImageCache.add_missing_images = pytestconfig.getoption(
          "add_missing_images"
      )
      VerifyImageCache.reset_only_failed = pytestconfig.getoption(
          "reset_only_failed"
      )
  
      cache_dir = pytestconfig.getoption("image_cache_dir")
      if cache_dir is None:
          cache_dir = pytestconfig.getini("image_cache_dir")
  
      gen_dir = pytestconfig.getoption("generated_image_dir")
      if gen_dir is None:
          gen_dir = pytestconfig.getini("generated_image_dir")
  
      verify_image_cache = VerifyImageCache(
          request.node.name, cache_dir, generated_image_dir=gen_dir
      )
      pyvista.global_theme.before_close_callback = verify_image_cache
  
      def reset():
          pyvista.global_theme.before_close_callback = None
  
      request.addfinalizer(reset)
      return verify_image_cache
  
file_path: pytest-pyvista/pytest_pyvista/pytest_pyvista.py
imports: import os
  import platform
  import warnings
  import pytest
  import pyvista
label_desc: Use image node_id 2 for calling a global function with example usage: verify_image_cache(request, pytestconfig) and returns: verify_image_cache