def _output_loop(self):

        from twisted.internet import reactor

        if self.stopped is True:
            if self.outputting_d is not None:
                self.outputting_d.callback(True)
                self.outputting_d = None
            return

        blobs = self.download_manager.blobs
        log.info("In _output_loop. last_blob_outputted: %s", str(self.last_blob_outputted))
        if blobs:
            log.debug("Newest blob number: %s", str(max(blobs.iterkeys())))
        if self.outputting_d is None:
            self.outputting_d = defer.Deferred()

        current_blob_num = self.last_blob_outputted + 1

        def finished_outputting_blob():
            self.last_blob_outputted += 1
            final_blob_num = self.download_manager.final_blob_num()
            if final_blob_num is not None and final_blob_num == self.last_blob_outputted:
                self._finished_outputting()
                self.outputting_d.callback(True)
                self.outputting_d = None
            else:
                reactor.callLater(0, self._output_loop)

        if blobs in current_blob_num and blobs[current_blob_num].is_validated():
            log.info("Outputting blob %s", str(current_blob_num))
            self.provided_blob_nums.append(current_blob_num)
            d = self.download_manager.handle_blob(current_blob_num)
            d.addCallback(lambda _: finished_outputting_blob())
            d.addCallback(lambda _: self._finished_with_blob(current_blob_num))
        elif blobs and max(blobs.iterkeys()) > self.last_blob_outputted + self.max_before_skip_ahead - 1:
            self.last_blob_outputted += 1
            log.info("Skipping blob number %s due to knowing about blob number %s",
                     str(self.last_blob_outputted), str(max(blobs.iterkeys())))
            self._finished_with_blob(current_blob_num)
            reactor.callLater(0, self._output_loop)
        else:
            self.outputting_d.callback(True)
            self.outputting_d = None
dataset/ETHPy150Open lbryio/lbry/lbrynet/lbrylive/client/LiveStreamProgressManager.py/LiveStreamProgressManager._output_loop/swapped operands of `in`