code: def resize_PIL(
      dim, channel_first, dtype, interp, data, size, roi_start, roi_end
  ):
      pil_resample = resample_dali2pil[interp]
  
      assert dtype == types.UINT8 or dtype == types.FLOAT
      dtype = np.uint8 if dtype == types.UINT8 else np.float32
  
      base_func = resize3D_PIL if dim == 3 else resize2D_PIL
      f = functools.partial(
          base_func,
          channel_first=channel_first,
          dtype=dtype,
          resample=pil_resample,
      )
  
      return dali.fn.python_function(
          data,
          size,
          roi_start,
          roi_end,
          function=f,
          batch_processing=False,
      )
  
imports: import cv2
  import functools
  import math
  import numpy
  import nvidia.dali
  import nvidia.dali.fn
  import nvidia.dali.types
  import os.path
  from nvidia.dali import Pipeline, pipeline_def
  from nvidia.dali.data_node import DataNode
  from test_utils import check_batch, get_dali_extra_path, as_array
  import PIL.Image
label_desc: Use image node_id 4 for calling a global function with example usage: resize_PIL(dim, channel_first, dtype, interp, data, size, roi_start, roi_end) and returns: dali