code: def _endprint(x, flag, fval, maxfun, xtol, disp):
      if flag == 0:
          if disp > 1:
              print(
                  "\nOptimization terminated successfully;\n"
                  "The returned value satisfies the termination criteria\n"
                  "(using xtol = ",
                  xtol,
                  ")",
              )
      if flag == 1:
          if disp:
              print(
                  "\nMaximum number of function evaluations exceeded --- "
                  "increase maxfun argument.\n"
              )
      if flag == 2:
          if disp:
              print("\n{}".format(_status_message["nan"]))
      return
  
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 35 for calling a global function with example usage: _endprint(x, flag, fval, maxfun, xtol, disp) without return types