code: def consume_queue(queue, cascade_stop):
      
      while True:
          try:
              item = queue.get(timeout=0.1)
          except Empty:
              yield None
              continue
          # See https://github.com/docker/compose/issues/189
          except thread.error:
              raise ShutdownException()
  
          if item.exc:
              raise item.exc
  
          if item.is_stop:
              if cascade_stop:
                  raise StopIteration
              else:
                  continue
  
          yield item.item
docs: Consume the queue by reading lines off of it and yielding them.