Cleans up from a previous task that didn't exit cleanly.

            Returns ``True`` if previous task was cleaned.

def _clean_prior(self):
        """ Cleans up from a previous task that didn't exit cleanly.

            Returns ``True`` if previous task was cleaned.
            """

        if self._loaded:
            try:
                pid_file = daemon.get_daemon_pidfile(self)

                # check if it exists so we don't raise
                if os.path.isfile(pid_file):
                    # read pid from file
                    pid = int(common.readfile(pid_file))

                    # check if pid file is stale
                    if pid and not daemon.pid_exists(pid):
                        common.safe_remove_file(pid_file)
                        raise ValueError

            except (ValueError, TypeError):
                self._clean()
                return True

        return False