code: def pixelate(x, severity=1):
    
    c = [0.6, 0.5, 0.4, 0.3, 0.25][severity - 1]
    shape = x.shape
    x = tfds.core.lazy_imports.PIL_Image.fromarray(x.astype(np.uint8))
    x = x.resize((int(shape[1] * c), int(shape[0] * c)))
    x = x.resize((shape[1], shape[0]))
    return np.asarray(x)
docs: Pixelate images.
  
    Conduct pixelating corruptions to images by first shrinking the images and
    then resizing to original size.
  
    Args:
      x: numpy array, uncorrupted image, assumed to have uint8 pixel in [0,255].
      severity: integer, severity of corruption.
  
    Returns:
      numpy array, image with uint8 pixels in [0,255]. Applied pixelating
      corruption.