<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, size=None):
 """ Read a line from the stream, including the trailing new line character. If `size` is set, don't read more than `size` bytes, even if the result does not represent a complete line. The last line read may not include a trailing new line character if one was not present in the underlying stream. """

        if self._pos >= self.length:
            return ''
        if size:
            amount = min(size, (self.length - self._pos))
        else:
            amount = self.length - self._pos
        out = self.stream.readline(amount)
        self._pos += len(out)
        return out