code: def read(self, size=-1):
          
          self._check_readable()
          chunks = []
          bytes_read = 0
          bytes_left = size
          while True:
              chunk = self._buffer.get_chunk(bytes_left)
              if not chunk:
                  break
              chunks.append(chunk)
              bytes_read += len(chunk)
              if bytes_read == size or not chunk:
                  break
              if bytes_left > 0:
                  bytes_left -= len(chunk)
          # If EOF was set, always return that instead of any error.
          if not chunks and not self._buffer.eof and self._buffer.error:
              raise compat.saved_exc(self._buffer.error)
          return b''.join(chunks)
docs: Read up to *size* bytes.
  
          This function reads from the buffer multiple times until the requested
          number of bytes can be satisfied. This means that this function may
          block to wait for more data, even if some data is available. The only
          time a short read is returned, is on EOF or error.
  
          If *size* is not specified or negative, read until EOF.