code: def dump_queue(queue):
          
          result = []
  
          try:
              while True:
                  item = queue.get_nowait()
                  result.append(item)
          except: Empty
  
          return result
docs: Empties all pending items in a queue and returns them in a list.