code: def waitforqueues(queues, timeout=None):
      
      lock = threading.Condition(threading.Lock())
  
      prepare_queues(queues, lock)
      try:
          wait_queues(queues, lock, timeout)
      finally:
          reset_queues(queues)
  
      return filter(lambda q: not q.empty(), queues)
docs: Waits for one or more *Queue* to be ready or until *timeout* expires.
  
      *queues* is a list containing one or more *Queue.Queue* objects.
      If *timeout* is not None the function will block
      for the specified amount of seconds.
  
      The function returns a list containing the ready *Queues*.