code: def _wrap_function(function, args):
      # wraps a minimizer function to count number of evaluations
      # and to easily provide an args kwd.
      # A copy of x is sent to the user function (gh13740)
      ncalls = [0]
      if function is None:
          return ncalls, None
  
      def function_wrapper(x, *wrapper_args):
          ncalls[0] += 1
          return function(np.copy(x), *(wrapper_args + args))
  
      return ncalls, function_wrapper
  
imports: import warnings
  import sys
  from numpy import atleast_1d, eye, argmin, zeros, shape, squeeze, asarray, sqrt, Inf, asfarray, isinf
  import numpy
  from .linesearch import line_search_wolfe1, line_search_wolfe2, line_search_wolfe2, LineSearchWarning
  from ._numdiff import approx_derivative
  from scipy._lib._util import getfullargspec_no_self
  from scipy._lib._util import MapWrapper
  from scipy.optimize._differentiable_functions import ScalarFunction, FD_METHODS
label_desc: Use image node_id 11 for calling a global function with example usage: _wrap_function(function, args) and returns: ncalls,  function_wrapper, ncalls,  None, function