code: def x_frame2D(X,plot_limits=None,resolution=None):
      
      assert X.shape[1] ==2, "x_frame2D is defined for two-dimensional inputs"
      if plot_limits is None:
          xmin,xmax = X.min(0),X.max(0)
          xmin, xmax = xmin-0.2*(xmax-xmin), xmax+0.2*(xmax-xmin)
      elif len(plot_limits)==2:
          xmin, xmax = plot_limits
      else:
          raise ValueError("Bad limits for plotting")
  
      resolution = resolution or 50
      xx,yy = np.mgrid[xmin[0]:xmax[0]:1j*resolution,xmin[1]:xmax[1]:1j*resolution]
      Xnew = np.vstack((xx.flatten(),yy.flatten())).T
      return Xnew, xx, yy, xmin, xmax
docs: Internal helper function for making plots, returns a set of input values to plot as well as lower and upper limits