code: def _reproduce(
      stages: List["Stage"],
      graph: Optional["DiGraph"] = None,
      force_downstream: bool = False,
      on_error: str = "fail",
      force: bool = False,
      repro_fn: Callable = _reproduce_stage,
      **kwargs,
  ) -> List["Stage"]:
      assert on_error in ("fail", "keep-going", "ignore")
  
      result: List["Stage"] = []
      failed: List["Stage"] = []
      to_skip: Dict["Stage", "Stage"] = {}
      ret: Optional["Stage"] = None
  
      force_state = {node: force for node in stages}
  
      for stage in stages:
          if stage in to_skip:
              continue
  
          if ret:
              logger.info("")  # add a newline
  
          upstream, downstream = _get_upstream_downstream_nodes(
              graph, stage
          )
          force_stage = force_state[stage]
  
          try:
              ret = repro_fn(
                  stage, upstream=upstream, force=force_stage, **kwargs
              )
          except Exception as exc:  # noqa: BLE001
              failed.append(stage)
              if on_error == "fail":
                  _raise_error(exc, stage)
  
              dependents = handle_error(graph, on_error, exc, stage)
              to_skip.update({node: stage for node in dependents})
              continue
  
          if force_downstream and (ret or force_stage):
              force_state.update({node: True for node in downstream})
  
          if ret:
              result.append(ret)
  
      if on_error != "ignore" and failed:
          _raise_error(None, *failed)
      return result
  
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 10 for calling a global function with example usage: _reproduce(stages, graph, force_downstream, on_error, force, repro_fn) and returns: result