code: def _get_intermediate_simp(
      deffunc=lambda x: x,
      offfunc=lambda x: x,
      onfunc=_dotprodsimp,
      dotprodsimp=None,
  ):
      """Support function for controlling intermediate simplification. Returns a
      simplification function according to the global setting of dotprodsimp
      operation.
  
      ``deffunc``     - Function to be used by default.
      ``offfunc``     - Function to be used if dotprodsimp has been turned off.
      ``onfunc``      - Function to be used if dotprodsimp has been turned on.
      ``dotprodsimp`` - True, False or None. Will be overridden by global
                        _dotprodsimp_state.state if that is not None.
      """
  
      if dotprodsimp is False or _dotprodsimp_state.state is False:
          return offfunc
      if dotprodsimp is True or _dotprodsimp_state.state is True:
          return onfunc
  
      return deffunc
  
file_path: sympy/sympy/matrices/utilities.py
imports: from contextlib import contextmanager
  from threading import local
  from sympy.core.function import expand_mul
label_desc: Use image node_id 3 for calling a global function with example usage: _get_intermediate_simp(deffunc, offfunc, onfunc, dotprodsimp) and returns: deffunc, offfunc, onfunc