def handle_item(self, item):
        if isinstance(item, WorkflowItem) and not item.done:
            workflow = item
            try:
                generator = item.run(*item.args, **item.kwargs)
            except __HOLE__ as e:
                raise TypeError('Bad workflow function item=%r error=%s' % (
                                item, str(e)))
            item = None
        else:
            barrier = self.pending.dequeue(item)
            if barrier is None:
                LOGGER.debug('Could not find barrier for finished item=%r',
                             item)
                return None
            item = barrier.get_item()
            workflow = barrier.workflow
            generator = barrier.generator

        return self._progress_workflow(item, workflow, generator)
dataset/ETHPy150Open bslatkin/dpxdt/dpxdt/client/workers.py/WorkflowThread.handle_item