code: def bracket(
      func, xa=0.0, xb=1.0, args=(), grow_limit=110.0, maxiter=1000
  ):
      """
      Bracket the minimum of the function.
  
      Given a function and distinct initial points, search in the
      downhill direction (as defined by the initial points) and return
      new points xa, xb, xc that bracket the minimum of the function
      f(xa) > f(xb) < f(xc). It doesn't always mean that obtained
      solution will satisfy xa<=x<=xb.
  
      Parameters
      ----------
      func : callable f(x,*args)
          Objective function to minimize.
      xa, xb : float, optional
          Bracketing interval. Defaults `xa` to 0.0, and `xb` to 1.0.
      args : tuple, optional
          Additional arguments (if present), passed to `func`.
      grow_limit : float, optional
          Maximum grow limit.  Defaults to 110.0
      maxiter : int, optional
          Maximum number of iterations to perform. Defaults to 1000.
  
      Returns
      -------
      xa, xb, xc : float
          Bracket.
      fa, fb, fc : float
          Objective function values in bracket.
      funcalls : int
          Number of function evaluations made.
  
      Examples
      --------
      This function can find a downward convex region of a function:
  
      >>> import matplotlib.pyplot as plt
      >>> from scipy.optimize import bracket
      >>> def f(x):
      ...     return 10*x**2 + 3*x + 5
      >>> x = np.linspace(-2, 2)
      >>> y = f(x)
      >>> init_xa, init_xb = 0, 1
      >>> xa, xb, xc, fa, fb, fc, funcalls = bracket(f, xa=init_xa, xb=init_xb)
      >>> plt.axvline(x=init_xa, color="k", linestyle="--")
      >>> plt.axvline(x=init_xb, color="k", linestyle="--")
      >>> plt.plot(x, y, "-k")
      >>> plt.plot(xa, fa, "bx")
      >>> plt.plot(xb, fb, "rx")
      >>> plt.plot(xc, fc, "bx")
      >>> plt.show()
  
      """
      _gold = 1.618034  # golden ratio: (1.0+sqrt(5.0))/2.0
      _verysmall_num = 1e-21
      fa = func(*(xa,) + args)
      fb = func(*(xb,) + args)
      if fa < fb:  # Switch so fa > fb
          xa, xb = xb, xa
          fa, fb = fb, fa
      xc = xb + _gold * (xb - xa)
      fc = func(*((xc,) + args))
      funcalls = 3
      iter = 0
      while fc < fb:
          tmp1 = (xb - xa) * (fb - fc)
          tmp2 = (xb - xc) * (fb - fa)
          val = tmp2 - tmp1
          if np.abs(val) < _verysmall_num:
              denom = 2.0 * _verysmall_num
          else:
              denom = 2.0 * val
          w = xb - ((xb - xc) * tmp2 - (xb - xa) * tmp1) / denom
          wlim = xb + grow_limit * (xc - xb)
          if iter > maxiter:
              raise RuntimeError("Too many iterations.")
          iter += 1
          if (w - xc) * (xb - w) > 0.0:
              fw = func(*((w,) + args))
              funcalls += 1
              if fw < fc:
                  xa = xb
                  xb = w
                  fa = fb
                  fb = fw
                  return xa, xb, xc, fa, fb, fc, funcalls
              elif fw > fb:
                  xc = w
                  fc = fw
                  return xa, xb, xc, fa, fb, fc, funcalls
              w = xc + _gold * (xc - xb)
              fw = func(*((w,) + args))
              funcalls += 1
          elif (w - wlim) * (wlim - xc) >= 0.0:
              w = wlim
              fw = func(*((w,) + args))
              funcalls += 1
          elif (w - wlim) * (xc - w) > 0.0:
              fw = func(*((w,) + args))
              funcalls += 1
              if fw < fc:
                  xb = xc
                  xc = w
                  w = xc + _gold * (xc - xb)
                  fb = fc
                  fc = fw
                  fw = func(*((w,) + args))
                  funcalls += 1
          else:
              w = xc + _gold * (xc - xb)
              fw = func(*((w,) + args))
              funcalls += 1
          xa = xb
          xb = xc
          xc = w
          fa = fb
          fb = fc
          fc = fw
      return xa, xb, xc, fa, fb, fc, funcalls
  
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 30 for calling a global function with example usage: bracket(func, xa, xb, args, grow_limit, maxiter) and returns: xa,  xb,  xc,  fa,  fb,  fc,  funcalls, xa,  xb,  xc,  fa,  fb,  fc,  funcalls, xa,  xb,  xc,  fa,  fb,  fc,  funcalls