code: def plan_repro(
      graph: "DiGraph",
      stages: Optional[List["T"]] = None,
      pipeline: bool = False,
      downstream: bool = False,
  ) -> List["T"]:
      r"""Derive the evaluation of the given node for the given graph.
  
      When you _reproduce a stage_, you want to _evaluate the descendants_
      to know if it make sense to _recompute_ it. A post-ordered search
      will give us an order list of the nodes we want.
  
      For example, let's say that we have the following pipeline:
  
                                 E
                                / \
                               D   F
                              / \   \
                             B   C   G
                              \ /
                               A
  
      The derived evaluation of D would be: [A, B, C, D]
  
      In case that `downstream` option is specified, the desired effect
      is to derive the evaluation starting from the given stage up to the
      ancestors. However, the `networkx.ancestors` returns a set, without
      any guarantee of any order, so we are going to reverse the graph and
      use a reverse post-ordered search using the given stage as a starting
      point.
  
                     E                                   A
                    / \                                 / \
                   D   F                               B   C   G
                  / \   \        --- reverse -->        \ /   /
                 B   C   G                               D   F
                  \ /                                     \ /
                   A                                       E
  
      The derived evaluation of _downstream_ B would be: [B, D, E]
      """
      import networkx as nx
  
      sub = get_subgraph(
          graph, stages, pipeline=pipeline, downstream=downstream
      )
      return list(nx.dfs_postorder_nodes(sub))
  
file_path: dvc/dvc/repo/reproduce.py
imports: from typing import TYPE_CHECKING, Callable, Dict, Iterable, List, NoReturn, Optional, Set, Tuple, TypeVar, Union, cast
  from funcy import ldistinct
  from dvc.exceptions import ReproductionError
  from dvc.log import logger
  from dvc.repo.scm_context import scm_context
  from dvc.stage.cache import RunCacheNotSupported
  from dvc.utils import humanize
  from dvc.utils.collections import ensure_list
  from .None import locked
label_desc: Use image node_id 4 for calling a global function with example usage: plan_repro(graph, stages, pipeline, downstream) and returns: list