code: def gaussian_kernel(sigma, truncate=4.0):
      
  
      sigma = float(sigma)
      radius = int(truncate * sigma + 0.5)
  
      x, y = np.mgrid[-radius:radius + 1, -radius:radius + 1]
      sigma = sigma ** 2
  
      k = 2 * np.exp(-0.5 * (x ** 2 + y ** 2) / sigma)
      k = k / np.sum(k)
  
      return k
docs: Return Gaussian that truncates at the given number of std deviations.
  
      Adapted from https://github.com/nicjhan/gaussian-filter