<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_for_subworkflows(self, workflow_results):
        '''Wait for results from subworkflows'''
        wf_ids = sum([x['pending_workflows'] for x in workflow_results], [])
        for wf_id in wf_ids:
            # here we did not check if workflow ids match
            yield self.socket
            res = self.socket.recv_pyobj()
            if res is None:
                sys.exit(0)
            elif isinstance(res, Exception):
                raise res