<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def last_message(self, timeout=5):
 """ Wait a specified amount of time and return the last message from the task :rtype: str """

        if self._thread is not None:
            self._thread.join(timeout=timeout)
        return self._task.last_message