'Fixes symlinks in the event of an incomplete version update.
If there is no problem with the current symlinks, this function
has no effect.'

def _fix_symlinks(self):

    previous_symlinks = self._previous_symlinks()
    if all((os.path.exists(link[1]) for link in previous_symlinks)):
        for (kind, previous_link) in previous_symlinks:
            current_link = getattr(self, kind)
            if os.path.lexists(current_link):
                os.unlink(current_link)
            os.symlink(os.readlink(previous_link), current_link)
    for (_, link) in previous_symlinks:
        if os.path.exists(link):
            os.unlink(link)
