code: def test_pil_serializer(mode):
      serializer = PILSerializer()
  
      from PIL import Image
  
      np_data = np.random.randint(255, size=(28, 28), dtype=np.uint32)
      img = Image.fromarray(np_data).convert(mode)
  
      data, _ = serializer.serialize(img)
      assert isinstance(data, bytes)
  
      deserialized_img = serializer.deserialize(data)
      deserialized_img = deserialized_img.convert("I")
      np_dec_data = np.asarray(deserialized_img, dtype=np.uint32)
      assert isinstance(deserialized_img, Image.Image)
  
      # Validate data content
      assert np.array_equal(np_data, np_dec_data)
  
file_path: pytorch-lightning/tests/tests_data/streaming/test_serializer.py
imports: import os
  import sys
  from time import time
  import numpy
  import pytest
  import torch
  from lightning import seed_everything
  from lightning.data.streaming.serializers import _AV_AVAILABLE, _NUMPY_DTYPES_MAPPING, _SERIALIZERS, _TORCH_DTYPES_MAPPING, _TORCH_VISION_AVAILABLE, IntSerializer, NoHeaderNumpySerializer, NoHeaderTensorSerializer, NumpySerializer, PickleSerializer, PILSerializer, TensorSerializer, VideoSerializer
  from lightning_utilities.core.imports import RequirementCache
label_desc: Use image node_id 3 for calling a global function with example usage: test_pil_serializer(mode) without return types