def draw(rg, func):
    fig = plt.figure()
    ax = Axes3D(fig)
    X = copy.deepcopy(rg)#np.arange(-5, 5, 5/100.0)
    Y = copy.deepcopy(rg)#np.arange(-5, 5, 5/100.0)
    X, Y = np.meshgrid(X, Y)
    R = func(X,Y)
    ax.plot_surface(X, Y, R, rstride=1, cstride=1, cmap='rainbow')
    plt.show()
    return R

The missing part of my code.