code: def _minimize_scalar_brent(
      func,
      brack=None,
      args=(),
      xtol=1.48e-8,
      maxiter=500,
      **unknown_options,
  ):
      """
      Options
      -------
      maxiter : int
          Maximum number of iterations to perform.
      xtol : float
          Relative error in solution `xopt` acceptable for convergence.
  
      Notes
      -----
      Uses inverse parabolic interpolation when possible to speed up
      convergence of golden section method.
  
      """
      _check_unknown_options(unknown_options)
      tol = xtol
      if tol < 0:
          raise ValueError("tolerance should be >= 0, got %r" % tol)
  
      brent = Brent(
          func=func,
          args=args,
          tol=tol,
          full_output=True,
          maxiter=maxiter,
      )
      brent.set_bracket(brack)
      brent.optimize()
      x, fval, nit, nfev = brent.get_result(full_output=True)
  
      success = nit < maxiter and not (np.isnan(x) or np.isnan(fval))
  
      return OptimizeResult(
          fun=fval, x=x, nit=nit, nfev=nfev, success=success
      )
  
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 27 for calling a global function with example usage: _minimize_scalar_brent(func, brack, args, xtol, maxiter) and returns: OptimizeResult