code: def gaussian_kernel(data_shape, sigma, norm='max'):
      r
  
      if not import_astropy:  # pragma: no cover
          raise ImportError('Astropy package not found.')
  
      if norm not in ('max', 'sum', 'none'):
          raise ValueError('Invalid norm, options are "max", "sum" or "none".')
  
      kernel = np.array(Gaussian2DKernel(sigma, x_size=data_shape[1],
                        y_size=data_shape[0]))
  
      if norm == 'max':
          return kernel / np.max(kernel)
  
      elif norm == 'sum':
          return kernel / np.sum(kernel)
  
      elif norm == 'none':
          return kernel
docs: r"""Gaussian kernel
  
      This method produces a Gaussian kerenal of a specified size and dispersion
  
      Parameters
      ----------
      data_shape : tuple
          Desiered shape of the kernel
      sigma : float
          Standard deviation of the kernel
      norm : str {'max', 'sum', 'none'}, optional
          Normalisation of the kerenl (options are 'max', 'sum' or 'none')
  
      Returns
      -------
      np.ndarray kernel
  
      Examples
      --------
      >>> from modopt.math.stats import gaussian_kernel
      >>> gaussian_kernel((3, 3), 1)
      array([[ 0.36787944,  0.60653066,  0.36787944],
             [ 0.60653066,  1.        ,  0.60653066],
             [ 0.36787944,  0.60653066,  0.36787944]])
  
      >>> gaussian_kernel((3, 3), 1, norm='sum')
      array([[ 0.07511361,  0.1238414 ,  0.07511361],
             [ 0.1238414 ,  0.20417996,  0.1238414 ],
             [ 0.07511361,  0.1238414 ,  0.07511361]])