code: def _wrap(function, args):
      ncalls = [0]
  
      def wrapper(x):
          ncalls[0] += 1
          return function(x, *args)
  
      return ncalls, wrapper
  
imports: import numpy
  from scipy.optimize import approx_fprime, brent
label_desc: Use image node_id 2 for calling a global function with example usage: _wrap(function, args) and returns: ncalls,  wrapper, function