def convolve(signal,kernel):
pad=np.ones(len(kernel)/<NUM_LIT:2>)<EOL>signal=np.concatenate((pad*signal[<NUM_LIT:0>],signal,pad*signal[-<NUM_LIT:1>]))<EOL>signal=np.convolve(signal,kernel,mode='<STR_LIT>')<EOL>signal=signal[len(pad):-len(pad)]<EOL>return signal<EOL>
This applies a kernel to a signal through convolution and returns the result.

Some magic is done at the edges so the result doesn't apprach zero:
    1. extend the signal's edges with len(kernel)/2 duplicated values
    2. perform the convolution ('same' mode)
    3. slice-off the ends we added
    4. return the same number of points as the original