code: def readlines(self, timeout=1):
          
          lines = []
          while 1:
              line = self.readline(timeout=timeout)
              if line:
                  lines.append(line)
              if not line or line[-1:] != '\n':
                  break
          return lines
docs: read all lines that are available. abort after timeout
          when no more data arrives.