<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def gaussian(shape, sd=1.0):
 """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. """


    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