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.

def restore(cdiff, a):
    """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.
    """
    left = a.splitlines(1) if isinstance(a, string_types) else a
    lrest = []
    iline = 0
    
    for i, line in enumerate(left):
        if iline not in cdiff:
            lrest.append("  " + line)
            iline += 1
        else:
            cs = [l[0] for l in cdiff[iline]]
            add = cs.count('+') - cs.count('-')
            lrest.extend(cdiff[iline])
            iline += add + 1
            
    for i in sorted(cdiff.keys()):
        if i >= len(left):
            lrest.extend(cdiff[i])

    from difflib import restore
    return list(restore(lrest, 2))