code: def condition(
      cond: Callable[[_T], bool], rule: Callable[[_T], _T]
  ) -> Callable[[_T], _T]:
      """Only apply rule if condition is true"""
  
      def conditioned_rl(expr: _T) -> _T:
          if cond(expr):
              return rule(expr)
          return expr
  
      return conditioned_rl
  
file_path: sympy/sympy/strategies/core.py
imports: from __future__ import annotations
  from collections.abc import Callable, Mapping
  from typing import TypeVar
  from sys import stdout
label_desc: Use image node_id 4 for calling a global function with example usage: condition(cond, rule) and returns: conditioned_rl, expr, rule