'Read one entire line from the file. If size is present
and non-negative, return a string with at most that
size, which may be an incomplete line.'

def readline(self, size=(-1)):

    if self.closed:
        raise ValueError('I/O    operation    on    closed    file')
    pos = (self.buffer.find('\n') + 1)
    if (pos == 0):
        while True:
            buf = self.fileobj.read(self.blocksize)
            self.buffer += buf
            if ((not buf) or ('\n' in buf)):
                pos = (self.buffer.find('\n') + 1)
                if (pos == 0):
                    pos = len(self.buffer)
                break
    if (size != (-1)):
        pos = min(size, pos)
    buf = self.buffer[:pos]
    self.buffer = self.buffer[pos:]
    self.position += len(buf)
    return buf
