code: def golden(
      func,
      args=(),
      brack=None,
      tol=_epsilon,
      full_output=0,
      maxiter=5000,
  ):
      """
      Return the minimum of a function of one variable using golden section
      method.
  
      Given a function of one variable and a possible bracketing interval,
      return the minimum of the function isolated to a fractional precision of
      tol.
  
      Parameters
      ----------
      func : callable func(x,*args)
          Objective function to minimize.
      args : tuple, optional
          Additional arguments (if present), passed to func.
      brack : tuple, optional
          Triple (a,b,c), where (a<b<c) and func(b) <
          func(a),func(c). If bracket consists of two numbers (a,
          c), then they are assumed to be a starting interval for a
          downhill bracket search (see `bracket`); it doesn't always
          mean that obtained solution will satisfy a<=x<=c.
      tol : float, optional
          x tolerance stop criterion
      full_output : bool, optional
          If True, return optional outputs.
      maxiter : int
          Maximum number of iterations to perform.
  
      See also
      --------
      minimize_scalar: Interface to minimization algorithms for scalar
          univariate functions. See the 'Golden' `method` in particular.
  
      Notes
      -----
      Uses analog of bisection method to decrease the bracketed
      interval.
  
      Examples
      --------
      We illustrate the behaviour of the function when `brack` is of
      size 2 and 3, respectively. In the case where `brack` is of the
      form (xa,xb), we can see for the given values, the output need
      not necessarily lie in the range ``(xa, xb)``.
  
      >>> def f(x):
      ...     return x**2
  
      >>> from scipy import optimize
  
      >>> minimum = optimize.golden(f, brack=(1, 2))
      >>> minimum
      1.5717277788484873e-162
      >>> minimum = optimize.golden(f, brack=(-1, 0.5, 2))
      >>> minimum
      -1.5717277788484873e-162
  
      """
      options = {"xtol": tol, "maxiter": maxiter}
      res = _minimize_scalar_golden(func, brack, args, **options)
      if full_output:
          return res["x"], res["fun"], res["nfev"]
      else:
          return res["x"]
  
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 28 for calling a global function with example usage: golden(func, args, brack, tol, full_output, maxiter) and returns: res,  res,  res, res