'Undelete all messages marked for deletion.
Move each message marked for deletion from the I{.Trash/} subfolder back
to its original position.'

def undeleteMessages(self):

    for (real, trash) in self.deleted.items():
        try:
            os.rename(trash, real)
        except OSError as e:
            (err, estr) = e.args
            import errno
            if (err != errno.ENOENT):
                raise
        else:
            try:
                self.list[self.list.index(0)] = real
            except ValueError:
                self.list.append(real)
    self.deleted.clear()
