code: def add_speckle_noise(img, noise_level1=2, noise_level2=25):
      noise_level = random.randint(noise_level1, noise_level2)
      img = np.clip(img, 0.0, 1.0)
      rnum = random.random()
      if rnum > 0.6:
          img += img * np.random.normal(
              0, noise_level / 255.0, img.shape
          ).astype(np.float32)
      elif rnum < 0.4:
          img += img * np.random.normal(
              0, noise_level / 255.0, (*img.shape[:2], 1)
          ).astype(np.float32)
      else:
          L = noise_level2 / 255.0
          D = np.diag(np.random.rand(3))
          U = orth(np.random.rand(3, 3))
          conv = np.dot(np.dot(np.transpose(U), D), U)
          img += img * np.random.multivariate_normal(
              [0, 0, 0], np.abs(L**2 * conv), img.shape[:2]
          ).astype(np.float32)
      img = np.clip(img, 0.0, 1.0)
      return img
  
imports: import random
  from functools import partial
  import albumentations
  import cv2
  import ldm.modules.image_degradation.utils_image
  import numpy
  import scipy
  import scipy.stats
  import torch
  from scipy import ndimage
  from scipy.interpolate import interp2d
  from scipy.linalg import orth
label_desc: Use image node_id 19 for calling a global function with example usage: add_speckle_noise(img, noise_level1, noise_level2) and returns: img