code: def test_compare(solvername, x0, **kwds):
      my = eval("solvers.%s" % solvername)
      sp = eval("%s" % solvername)
      maxiter = kwds["maxiter"] if "maxiter" in kwds else None
      maxfun = kwds["maxfun"] if "maxfun" in kwds else None
      my_x = my(rosen, x0, disp=0, full_output=True, **kwds)
      # itermon = kwds.pop('itermon',None)
      try:
          sp_x = sp(rosen, x0, disp=0, full_output=True, **kwds)
      except:  # _MaxFuncCallError
          if HAS_SCIPY:
              return
          assert False
      # similar bestSolution and bestEnergy
      # print('my: %s' % my_x[0:2])
      # print('sp: %s' % sp_x[0:2])
      if my_x[3] == sp_x[-2]:  # mystic can stop at iter=0, scipy can't
          assert almostEqual(my_x[0], sp_x[0])
          assert almostEqual(my_x[1], sp_x[1])
      # print (iters, fcalls) and [maxiter, maxfun]
      # print('%s, %s, %s' % (my_x[2:4], (sp_x[-3],sp_x[-2]), [maxiter, maxfun]))
      # test same number of iters and fcalls
      if maxiter and maxfun is not None:
          assert my_x[2] == sp_x[-3]
          assert my_x[3] == sp_x[-2]
      #   # test fcalls <= maxfun
      #   assert my_x[3] <= maxfun
      if maxiter is not None:
          # test iters <= maxiter
          assert my_x[2] <= maxiter
      return
  
imports: import mystic.solvers
  from mystic.models import rosen
  from mystic.math import almostEqual
  from mystic.monitors import VerboseMonitor
  from mystic.tools import random_seed
label_desc: Use image node_id 2 for calling a global function with example usage: test_compare(solvername, x0) without return types