code: def solve_event_equation(event, sol, t_old, t):
      """Solve an equation corresponding to an ODE event.
  
      The equation is ``event(t, y(t)) = 0``, here ``y(t)`` is known from an
      ODE solver using some sort of interpolation. It is solved by
      `scipy.optimize.brentq` with xtol=atol=4*EPS.
  
      Parameters
      ----------
      event : callable
          Function ``event(t, y)``.
      sol : callable
          Function ``sol(t)`` which evaluates an ODE solution between `t_old`
          and  `t`.
      t_old, t : float
          Previous and new values of time. They will be used as a bracketing
          interval.
  
      Returns
      -------
      root : float
          Found solution.
      """
      from scipy.optimize import brentq
  
      return brentq(
          lambda t: event(t, sol(t)),
          t_old,
          t,
          xtol=4 * EPS,
          rtol=4 * EPS,
      )
  
file_path: catboost/contrib/python/scipy/py2/scipy/integrate/_ivp/ivp.py
imports: from __future__ import division, print_function, absolute_import
  import inspect
  import numpy
  from .bdf import BDF
  from .radau import Radau
  from .rk import RK23, RK45
  from .lsoda import LSODA
  from scipy.optimize import OptimizeResult
  from .common import EPS, OdeSolution
  from .base import OdeSolver
label_desc: Use image node_id 2 for calling a global function with example usage: solve_event_equation(event, sol, t_old, t) and returns: brentq