code: def fminbound(
      func,
      x1,
      x2,
      args=(),
      xtol=1e-5,
      maxfun=500,
      full_output=0,
      disp=1,
  ):
      """Bounded minimization for scalar functions.
  
      Parameters
      ----------
      func : callable f(x,*args)
          Objective function to be minimized (must accept and return scalars).
      x1, x2 : float or array scalar
          The optimization bounds.
      args : tuple, optional
          Extra arguments passed to function.
      xtol : float, optional
          The convergence tolerance.
      maxfun : int, optional
          Maximum number of function evaluations allowed.
      full_output : bool, optional
          If True, return optional outputs.
      disp : int, optional
          If non-zero, print messages.
              0 : no message printing.
              1 : non-convergence notification messages only.
              2 : print a message on convergence too.
              3 : print iteration results.
  
  
      Returns
      -------
      xopt : ndarray
          Parameters (over given interval) which minimize the
          objective function.
      fval : number
          The function value at the minimum point.
      ierr : int
          An error flag (0 if converged, 1 if maximum number of
          function calls reached).
      numfunc : int
        The number of function calls made.
  
      See also
      --------
      minimize_scalar: Interface to minimization algorithms for scalar
          univariate functions. See the 'Bounded' `method` in particular.
  
      Notes
      -----
      Finds a local minimizer of the scalar function `func` in the
      interval x1 < xopt < x2 using Brent's method.  (See `brent`
      for auto-bracketing).
  
      Examples
      --------
      `fminbound` finds the minimum of the function in the given range.
      The following examples illustrate the same
  
      >>> def f(x):
      ...     return x**2
  
      >>> from scipy import optimize
  
      >>> minimum = optimize.fminbound(f, -1, 2)
      >>> minimum
      0.0
      >>> minimum = optimize.fminbound(f, 1, 2)
      >>> minimum
      1.0000059608609866
      """
      options = {"xatol": xtol, "maxiter": maxfun, "disp": disp}
  
      res = _minimize_scalar_bounded(func, (x1, x2), args, **options)
      if full_output:
          return res["x"], res["fun"], res["status"], res["nfev"]
      else:
          return res["x"]
  
imports: from __future__ import division, print_function, absolute_import
  import warnings
  import sys
  import numpy
  from scipy._lib.six import callable, xrange
  from numpy import atleast_1d, eye, mgrid, argmin, zeros, shape, squeeze, vectorize, asarray, sqrt, Inf, asfarray, isinf
  import numpy
  from .linesearch import line_search_wolfe1, line_search_wolfe2, line_search_wolfe2, LineSearchWarning
  from scipy._lib._util import getargspec_no_self
label_desc: Use image node_id 22 for calling a global function with example usage: fminbound(func, x1, x2, args, xtol, maxfun, full_output, disp) and returns: res,  res,  res,  res, res