code: def spatter(x, severity=1):
      """Apply spatter to images.
  
      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 spatter.
      """
      cv2 = tfds.core.lazy_imports.cv2
      skimage = tfds.core.lazy_imports.skimage
      c = [
          (0.65, 0.3, 4, 0.69, 0.6, 0),
          (0.65, 0.3, 3, 0.68, 0.6, 0),
          (0.65, 0.3, 2, 0.68, 0.5, 0),
          (0.65, 0.3, 1, 0.65, 1.5, 1),
          (0.67, 0.4, 1, 0.65, 1.5, 1),
      ][severity - 1]
      x = np.array(x, dtype=np.float32) / 255.0
  
      liquid_layer = np.random.normal(
          size=x.shape[:2], loc=c[0], scale=c[1]
      )
  
      liquid_layer = skimage.filters.gaussian(liquid_layer, sigma=c[2])
      liquid_layer[liquid_layer < c[3]] = 0
      if c[5] == 0:
          liquid_layer = (liquid_layer * 255).astype(np.uint8)
          dist = 255 - cv2.Canny(liquid_layer, 50, 150)
          dist = cv2.distanceTransform(dist, cv2.DIST_L2, 5)
          _, dist = cv2.threshold(dist, 20, 20, cv2.THRESH_TRUNC)
          dist = cv2.blur(dist, (3, 3)).astype(np.uint8)
          dist = cv2.equalizeHist(dist)
          #     ker = np.array([[-1,-2,-3],[-2,0,0],[-3,0,1]], dtype=np.float32)
          #     ker -= np.mean(ker)
          ker = np.array([[-2, -1, 0], [-1, 1, 1], [0, 1, 2]])
          dist = cv2.filter2D(dist, cv2.CV_8U, ker)
          dist = cv2.blur(dist, (3, 3)).astype(np.float32)
  
          m = cv2.cvtColor(liquid_layer * dist, cv2.COLOR_GRAY2BGRA)
          m /= np.max(m, axis=(0, 1))
          m *= c[4]
  
          # water is pale turqouise
          color = np.concatenate(
              (
                  175 / 255.0 * np.ones_like(m[..., :1]),
                  238 / 255.0 * np.ones_like(m[..., :1]),
                  238 / 255.0 * np.ones_like(m[..., :1]),
              ),
              axis=2,
          )
  
          color = cv2.cvtColor(color, cv2.COLOR_BGR2BGRA)
          x = cv2.cvtColor(x, cv2.COLOR_BGR2BGRA)
  
          x = (
              cv2.cvtColor(
                  np.clip(x + m * color, 0, 1), cv2.COLOR_BGRA2BGR
              )
              * 255
          )
      else:
          m = np.where(liquid_layer > c[3], 1, 0)
          m = skimage.filters.gaussian(m.astype(np.float32), sigma=c[4])
          m[m < 0.8] = 0
          #         m = np.abs(m) ** (1/c[4])
  
          # mud brown
          color = np.concatenate(
              (
                  63 / 255.0 * np.ones_like(x[..., :1]),
                  42 / 255.0 * np.ones_like(x[..., :1]),
                  20 / 255.0 * np.ones_like(x[..., :1]),
              ),
              axis=2,
          )
  
          color *= m[..., np.newaxis]
          x *= 1 - m[..., np.newaxis]
  
          x = np.clip(x + color, 0, 1) * 255
      return around_and_astype(x)
  
imports: import io
  import subprocess
  import tempfile
  import numpy
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  import tensorflow_datasets.public_api
label_desc: Use image node_id 23 for calling a global function with example usage: spatter(x, severity) and returns: around_and_astype