docs: def read(self, n=-1):
          """Read and return up to n bytes.
          If the argument is omitted, None, or negative, data is read and returned until EOF is reached..
          """
          if n is None or n < 0:
              buf = self._readbuffer[self._offset:]
              self._readbuffer = b''
              self._offset = 0
              while not self._eof:
                  buf += self._read1(self.MAX_N)
              return buf
  
          end = n + self._offset
          if end < len(self._readbuffer):
              buf = self._readbuffer[self._offset:end]
              self._offset = end
              return buf
  
          n = end - len(self._readbuffer)
          buf = self._readbuffer[self._offset:]
          self._readbuffer = b''
          self._offset = 0
          while n > 0 and not self._eof:
              data = self._read1(n)
              if n < len(data):
                  self._readbuffer = data
                  self._offset = n
                  buf += data[:n]
                  break
              buf += data
              n -= len(data)
          return buf