'Return data from `self.original_file` a line at a time,
replacing CR and CRLF with LF.'

def generate_lines(self):

    buf = self.original_file.read(self.buffer_size)
    line = ''
    while buf:
        for char in buf:
            if (line.endswith('\r') and (char == '\n')):
                last_line = line
                line = ''
                (yield self.sanitize(last_line))
            elif (line.endswith('\r') or line.endswith('\n')):
                last_line = line
                line = char
                (yield self.sanitize(last_line))
            else:
                line += char
        buf = self.original_file.read(self.buffer_size)
        if ((not buf) and line):
            (yield self.sanitize(line))
