'Read one entire line from the file. A trailing newline
character is kept in the string2.6 (but may be absent when a file ends
with an incomplete line). If the size argument is present and
non-negative, it is a maximum byte count (including the trailing
newline) and an incomplete line may be returned. An empty string is
returned when EOF is hit immediately. Note: unlike stdio\'s fgets(),
the returned string contains null characters (\'\') if they occurred
in the input.'

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

    maximum_result_size = self.__get_lines(size, (lambda buffer: ('\n' in buffer)))
    if ('\n' in self.buffer[:maximum_result_size]):
        result_size = (self.buffer.find('\n', 0, maximum_result_size) + 1)
        assert (result_size > 0)
    else:
        result_size = maximum_result_size
    return self.__extract_from_buffer(result_size)
