<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def readline(self):
 """ Read until a new-line character is encountered """

        line = ""
        n_pos = -1
        try:
            while n_pos < 0:
                line += self.next_chunk()
                n_pos = line.find('\n')
        except StopIteration:
            pass

        if n_pos >= 0:
            line, extra = line[:n_pos+1], line[n_pos+1:]
            self.unshift(extra)
        return line