code: def nextline(self):
          
          linebuf = b''
          linepos = self.bufpos + self.charpos
          eol = False
          while 1:
              self.fillbuf()
              if eol:
                  c = self.buf[self.charpos]
                  # handle b'\r\n'
                  if c == b'\n':
                      linebuf += c
                      self.charpos += 1
                  break
              m = EOL.search(self.buf, self.charpos)
              if m:
                  linebuf += self.buf[self.charpos:m.end(0)]
                  self.charpos = m.end(0)
                  if linebuf[-1] == b'\r':
                      eol = True
                  else:
                      break
              else:
                  linebuf += self.buf[self.charpos:]
                  self.charpos = len(self.buf)
          if self.debug:
              logging.debug('nextline: %r, %r' % (linepos, linebuf))
          return (linepos, linebuf)
docs: Fetches a next line that ends either with \\r or \\n.