Set the :class:`Work` associated to this `Task`.

def set_work(self, work):
        """Set the :class:`Work` associated to this `Task`."""
        if not hasattr(self, "_work"):
            self._work = work
        else:
            if self._work != work:
                raise ValueError("self._work != work")