def conv2(x, y, mode='same'):
    """
    Emulate the function conv2 from Mathworks.
    Usage:
    z = conv2(x,y,mode='same')
    TODO: 
     - Support other modes than 'same' (see conv2.m)
    """
if not mode == 'same':
    raise Exception('Mode not supported')
if len(x.shape) < len(y.shape):
    dim = x.shape
for i in range(len(x.shape), len(y.shape)):
    pass
Is there a Python equivalent of MATLAB's conv2 function?