def restore(cdiff, a):
left = a.splitlines(<NUM_LIT:1>) if isinstance(a, string_types) else a<EOL>lrest = []<EOL>iline = <NUM_LIT:0><EOL>for i, line in enumerate(left):<EOL><INDENT>if iline not in cdiff:<EOL><INDENT>lrest.append("<STR_LIT:U+0020>" + line)<EOL>iline += <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>cs = [l[<NUM_LIT:0>] for l in cdiff[iline]]<EOL>add = cs.count('<STR_LIT:+>') - cs.count('<STR_LIT:->')<EOL>lrest.extend(cdiff[iline])<EOL>iline += add + <NUM_LIT:1><EOL><DEDENT><DEDENT>for i in sorted(cdiff.keys()):<EOL><INDENT>if i >= len(left):<EOL><INDENT>lrest.extend(cdiff[i])<EOL><DEDENT><DEDENT>from difflib import restore<EOL>return list(restore(lrest, <NUM_LIT:2>))<EOL>
Restores the full text of either the edited text using the
    compressed diff.

    Args:
        cdiff (dict): compressed diff returned by
          :func:`~acorn.logging.diff.compress`. 
        a (str or list): *original* string or list of strings to use as a
          reference to restore the edited version.