code: def test_validator_coercion_PIL(validator):
      # Single pixel black png (http://png-pixel.com/)
  
      tests_dir = os.path.dirname(os.path.dirname(__file__))
      img_path = os.path.join(tests_dir, "resources", "1x1-black.png")
  
      with open(img_path, "rb") as f:
          hex_bytes = base64.b64encode(f.read()).decode("ascii")
          expected_uri = "data:image/png;base64," + hex_bytes
  
      img = Image.open(img_path)
      coerce_val = validator.validate_coerce(img)
      assert coerce_val == expected_uri
  
file_path: plotly.py/packages/python/plotly/_plotly_utils/tests/validators/test_imageuri_validator.py
imports: import base64
  import os
  import pytest
  from _plotly_utils.basevalidators import ImageUriValidator
  from PIL import Image
label_desc: Use image node_id 3 for calling a global function with example usage: test_validator_coercion_PIL(validator) without return types