code: def _line_search_wolfe12(
      f, fprime, xk, pk, gfk, old_fval, old_old_fval, **kwargs
  ):
      """
      Same as line_search_wolfe1, but fall back to line_search_wolfe2 if
      suitable step length is not found, and raise an exception if a
      suitable step length is not found.
  
      Raises
      ------
      _LineSearchError
          If no suitable step size is found
  
      """
      ret = line_search_wolfe1(
          f, fprime, xk, pk, gfk, old_fval, old_old_fval, **kwargs
      )
  
      if ret[0] is None:
          # line search failed: try different one.
          ret = line_search_wolfe2(
              f, fprime, xk, pk, gfk, old_fval, old_old_fval, **kwargs
          )
  
      if ret[0] is None:
          raise _LineSearchError()
  
      return ret
  
file_path: catboost/contrib/python/scikit-learn/py2/sklearn/utils/optimize.py
imports: import numpy
  import warnings
  from scipy.optimize.linesearch import line_search_wolfe2, line_search_wolfe1
  from ..exceptions import ConvergenceWarning
label_desc: Use image node_id 1 for calling a global function with example usage: _line_search_wolfe12(f, fprime, xk, pk, gfk, old_fval, old_old_fval) and returns: ret