def poly_kernel(X, Y, degree):
    """
    Computes the polynomial kernel k(x,y)=(1+theta*<x,y>)^degree for the given data
    X - samples on right hand side
    Y - samples on left hand side, can be None in which case its replaced by X
    """
    if Y is None:
        Y = X
    
    theta = 0.2
    return pow(theta + X.dot(Y.T), degree)