code: def find_open_image_png_function():
      try:
          from cv2 import imread
  
          def fun(filename):
              return imread(str(filename))
  
          return fun
      except ImportError:
          pass
  
      try:
          import numpy as np
          from PIL import Image
  
          def fun(filename):
              with Image.open(filename) as f:
                  return np.asarray(f)
  
          return fun
      except ImportError:
          pass
  
      raise ImportError(
          "PIL+NumPy or OpenCV required to run Cairo tests"
      )
  
file_path: python-igraph/tests/drawing/cairo/utils.py
imports: from pathlib import Path
  import sys
  import inspect
  import functools
  from igraph.drawing import find_cairo
label_desc: Use image node_id 1 for calling a global function with example usage: find_open_image_png_function() and returns: fun, fun, imread, np