code: def gaussian(shape, sd=1.0):
      
  
      gfn = lambda x, sd: np.exp(-(x**2) / (2.0 * sd**2)) / \
                          (np.sqrt(2.0 * np.pi) *sd)
      gc = 1.0
      if isinstance(shape, int):
          shape = (shape,)
      for k, n in enumerate(shape):
          x = np.linspace(-3.0, 3.0, n).reshape(
              (1,) * k + (n,) + (1,) * (len(shape) - k - 1))
          gc = gc * gfn(x, sd)
      gc /= np.sum(gc)
      return gc
docs: Sample a multivariate Gaussian pdf, normalised to have unit sum.
  
      Parameters
      ----------
      shape : tuple
        Shape of output array.
      sd : float, optional (default 1.0)
        Standard deviation of Gaussian pdf.
  
      Returns
      -------
      gc : ndarray
        Sampled Gaussian pdf.