code: def top_down(rule, fns=basic_fns):
      """Apply a rule down a tree running it on the top nodes first."""
      return chain(
          rule, lambda expr: sall(top_down(rule, fns), fns)(expr)
      )
  
imports: from sympy.strategies.util import basic_fns
  from sympy.strategies.core import chain, do_one
label_desc: Use image node_id 1 for calling a global function with example usage: top_down(rule, fns) and returns: chain