code: def test_sharpness(modality, dev):
      def sharpness_ref(img, magnitude):
          return ImageEnhance.Sharpness(img).enhance(magnitude)
  
      def post_proc(img):
          # pill applies convolution in valid mode (so for 3x3 kernel used,
          # the output is smaller by one pixel at each end, and then pastes
          # the filtered image onto the original). We don't do the
          # pasting
          return img[1:-1, 1:-1, :]
  
      data_source = get_images if modality == "image" else get_videos()
      sharpness = a.sharpness.augmentation(
          mag_range=(0.1, 1.9),
          randomly_negate=False,
          mag_to_param=a.sharpness_kernel_shifted,
      )
      magnitudes = sharpness._get_magnitudes(default_batch_size)
      compare_against_baseline(
          sharpness,
          pil_baseline(sharpness_ref),
          data_source,
          max_allowed_error=1,
          dev=dev,
          params=magnitudes,
          post_proc=post_proc,
          modality=modality,
      )
  
imports: import itertools
  import os
  import numpy
  from PIL import Image, ImageEnhance, ImageOps
  from nose2.tools import params, cartesian_params
  import nvidia.dali.tensors
  from nvidia.dali import fn, pipeline_def
  from nvidia.dali.auto_aug import augmentations
  from nvidia.dali.auto_aug.core._utils import get_translations
  from test_utils import get_dali_extra_path, check_batch
label_desc: Use image node_id 17 for calling a global function with example usage: test_sharpness(modality, dev) and returns: ImageEnhance, img