code: def setup_method_options(method, tuning_options):
      
      kwargs = {}
  
      #pass size of parameter space as max iterations to methods that support it
      #it seems not all methods iterpret this value in the same manner
      maxiter = numpy.prod([len(v) for v in tuning_options.tune_params.values()])
      kwargs['maxiter'] = maxiter
      if method in ["Nelder-Mead", "Powell"]:
          kwargs['maxfev'] = maxiter
      elif method == "L-BFGS-B":
          kwargs['maxfun'] = maxiter
  
      #pass eps to methods that support it
      if method in ["CG", "BFGS", "L-BFGS-B", "TNC", "SLSQP"]:
          kwargs['eps'] = tuning_options.eps
      elif method == "COBYLA":
          kwargs['rhobeg'] = tuning_options.eps
  
      return kwargs
docs: prepare method specific options