docs: def wait_for(self, text, seconds):
          """
          Returns True when the specified text has appeared in a line of the
          output, or False when the specified number of seconds have passed
          without that occurring.
          """
          found = False
          stream = self.stream
          start_time = time.time()
          while not found:
              if time.time() - start_time > seconds:
                  break
              stream.data_available.wait(0.5)
              stream.data_unoccupied.clear()
              while stream.data:
                  line = stream.data.pop(0)
                  value = line.getvalue()
                  if text in value:
                      found = True
                  self.lines.append(value)
                  stream.data_available.clear()
                  stream.data_unoccupied.set()
                  if time.time() - start_time > seconds:
                      break
          return found