code: def test_repro_plan(M):
      r"""
               1
             /  \
            2    3    8
           / \  / \   |
          4  5 6  7   9
      """
      g = DiGraph({1: [2, 3], 2: [4, 5], 3: [6, 7], 8: [9]})
  
      assert plan_repro(g) == [4, 5, 2, 6, 7, 3, 1, 9, 8]
      assert plan_repro(g, [1]) == [4, 5, 2, 6, 7, 3, 1]
      assert plan_repro(g, [4], downstream=True) == [4, 2, 1]
      assert (
          plan_repro(g, [8], True) == plan_repro(g, [9], True) == [9, 8]
      )
      assert plan_repro(g, [2, 8], True) == [4, 5, 2, 6, 7, 3, 1, 9, 8]
      assert plan_repro(g, [2, 3], downstream=True) == [
          M.any_of(2, 3),
          M.any_of(2, 3),
          1,
      ]
  
imports: from itertools import chain
  from networkx import DiGraph
  from networkx.utils import graphs_equal
  from dvc.repo.reproduce import get_active_graph, plan_repro
label_desc: Use image node_id 2 for calling a global function with example usage: test_repro_plan(M) without return types