code: def restore(delta, which):
      r"""
      Generate one of the two sequences that generated a delta.
  
      Given a `delta` produced by `Differ.compare()` or `ndiff()`, extract
      lines originating from file 1 or 2 (parameter `which`), stripping off line
      prefixes.
  
      Examples:
  
      >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(keepends=True),
      ...              'ore\ntree\nemu\n'.splitlines(keepends=True))
      >>> diff = list(diff)
      >>> print(''.join(restore(diff, 1)), end="")
      one
      two
      three
      >>> print(''.join(restore(diff, 2)), end="")
      ore
      tree
      emu
      """
      try:
          tag = {1: "- ", 2: "+ "}[int(which)]
      except KeyError:
          raise ValueError(
              "unknown delta choice (must be 1 or 2): %r" % which
          ) from None
      prefixes = ("  ", tag)
      for line in delta:
          if line[:2] in prefixes:
              yield line[2:]
  
imports: from heapq import nlargest
  from collections import namedtuple
  from types import GenericAlias
  import re
label_desc: Use image node_id 14 for calling a global function with example usage: restore(delta, which) without return types