human
Can you show me a Python function to convolve a Gaussian kernel.
assistant
Here is a Python function to convolve a Gaussian kernel

import numpy as np

def gaussian_kernel(sigma, size):
    """
    Convolve a gaussian kernel with a given size
    """
    x = np.arange(-(size - 1) / 2, (size + 1) / 2)
    g = np.exp(-x ** 2 / (2 * sigma ** 2))
    return g / g.sum()

# Enter the sigma
sigma = 1

# Enter the size
size = 5

# Calling the function
g = gaussian_kernel(sigma, size)

# Printing the kernel
print(g)

#Example Output
# [0.05448868 0.24420134 0.40261995 0.24420134 0.05448868]

#Remember to inspect code for bugs.