code: def glass_blur(
      x: np.ndarray,
      sigma: float,
      max_delta: int,
      iterations: int,
      xrange: tuple = None,
  ) -> np.ndarray:
      """
      Apply glass blur.
  
      Parameters
      ----------
      x
          Instance to be perturbed.
      sigma
          Standard deviation determining the strength of the Gaussian perturbation.
      max_delta
          Maximum pixel range for the blurring.
      iterations
          Number of blurring iterations.
      xrange
          Tuple with min and max data range.
  
      Returns
      -------
      Perturbed instance.
      """
      nrows, ncols = x.shape[:2]
  
      if not isinstance(xrange, tuple):
          xrange = (x.min(), x.max())
  
      if xrange[0] != 0 or xrange[1] != 255:
          x = (x - xrange[0]) / (xrange[1] - xrange[0]) * 255
  
      x = gaussian(x, sigma=sigma, channel_axis=-1).astype(
          np.uint8
      )  # assume [h, w, c] image layout
      for i in range(iterations):
          for h in range(nrows - max_delta, max_delta, -1):
              for w in range(ncols - max_delta, max_delta, -1):
                  dx, dy = np.random.randint(
                      -max_delta, max_delta, size=(2,)
                  )
                  h_prime, w_prime = h + dy, w + dx
                  x[h, w], x[h_prime, w_prime] = (
                      x[h_prime, w_prime],
                      x[h, w],
                  )
      x_gb = gaussian(x / 255, sigma=sigma, channel_axis=-1)
      x_gb = x_gb * (xrange[1] - xrange[0]) + xrange[0]
      if isinstance(xrange, tuple):
          return np.clip(x_gb, xrange[0], xrange[1])
      else:
          return x_gb
  
imports: import random
  from io import BytesIO
  from typing import List, Tuple, Union
  import cv2
  import numpy
  import skimage
  from alibi_detect.utils.data import Bunch
  from alibi_detect.utils.discretizer import Discretizer
  from alibi_detect.utils.distance import abdm, multidim_scaling
  from alibi_detect.utils.mapping import ohe2ord
  from PIL import Image
  from scipy.ndimage import zoom
  from scipy.ndimage.interpolation import map_coordinates
  from skimage.filters import gaussian
label_desc: Use image node_id 13 for calling a global function with example usage: glass_blur(x, sigma, max_delta, iterations, xrange) and returns: np, x_gb