<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def wait(self):
 """Run the client until all pending message in the queue have been processed. Returns whether the client is still running after the messages have been processed, or whether a shutdown has been initiated. :rtype: bool """

        running = True
        while running and self.messages_pending():
            running = self.do_work()
        return running