code: def sub_func_doit(eq, func, new):
      r"""
      When replacing the func with something else, we usually want the
      derivative evaluated, so this function helps in making that happen.
  
      Examples
      ========
  
      >>> from sympy import Derivative, symbols, Function
      >>> from sympy.solvers.ode.subscheck import sub_func_doit
      >>> x, z = symbols('x, z')
      >>> y = Function('y')
  
      >>> sub_func_doit(3*Derivative(y(x), x) - 1, y(x), x)
      2
  
      >>> sub_func_doit(x*Derivative(y(x), x) - y(x)**2 + y(x), y(x),
      ... 1/(x*(z + 1/x)))
      x*(-1/(x**2*(z + 1/x)) + 1/(x**3*(z + 1/x)**2)) + 1/(x*(z + 1/x))
      ...- 1/(x**2*(z + 1/x)**2)
      """
      reps = {func: new}
      for d in eq.atoms(Derivative):
          if d.expr == func:
              reps[d] = new.diff(*d.variable_count)
          else:
              reps[d] = d.xreplace({func: new}).doit(deep=False)
      return eq.xreplace(reps)
  
file_path: sympy/sympy/solvers/ode/subscheck.py
imports: from sympy.core import S, Pow
  from sympy.core.function import Derivative, AppliedUndef, diff
  from sympy.core.relational import Equality, Eq
  from sympy.core.symbol import Dummy
  from sympy.core.sympify import sympify
  from sympy.logic.boolalg import BooleanAtom
  from sympy.functions import exp
  from sympy.series import Order
  from sympy.simplify.simplify import simplify, posify, besselsimp
  from sympy.simplify.trigsimp import trigsimp
  from sympy.simplify.sqrtdenest import sqrtdenest
  from sympy.solvers import solve
  from sympy.solvers.deutils import _preprocess, ode_order
  from sympy.utilities.iterables import iterable, is_sequence
label_desc: Use image node_id 1 for calling a global function with example usage: sub_func_doit(eq, func, new) and returns: eq