def restore(delta, which):
try:<EOL><INDENT>tag = {<NUM_LIT:1>: "<STR_LIT>", <NUM_LIT:2>: "<STR_LIT>"}[int(which)]<EOL><DEDENT>except KeyError:<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>% which)<EOL><DEDENT>prefixes = ("<STR_LIT:U+0020>", tag)<EOL>for line in delta:<EOL><INDENT>if line[:<NUM_LIT:2>] in prefixes:<EOL><INDENT>yield line[<NUM_LIT:2>:]<EOL><DEDENT><DEDENT>
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(1),
    ...              'ore\ntree\nemu\n'.splitlines(1))
    >>> diff = list(diff)
    >>> print ''.join(restore(diff, 1)),
    one
    two
    three
    >>> print ''.join(restore(diff, 2)),
    ore
    tree
    emu