'A generator which yields rows which are ready to write to output.'

def checked_rows(self):

    length = len(self.column_names)
    line_number = self.reader.line_num
    joinable_row_errors = []
    for row in self.reader:
        try:
            if (len(row) != length):
                raise LengthMismatchError(line_number, row, length)
            (yield row)
            joinable_row_errors = []
        except LengthMismatchError as e:
            self.errors.append(e)
            if (len(row) > length):
                joinable_row_errors = []
            else:
                joinable_row_errors.append(e)
                while joinable_row_errors:
                    fixed_row = join_rows([error.row for error in joinable_row_errors], joiner='    ')
                    if (len(fixed_row) < length):
                        break
                    if (len(fixed_row) == length):
                        self.rows_joined += len(joinable_row_errors)
                        self.joins += 1
                        (yield fixed_row)
                        for fixed in joinable_row_errors:
                            joinable_row_errors.remove(fixed)
                            self.errors.remove(fixed)
                        break
                    joinable_row_errors = joinable_row_errors[1:]
        except CSVTestException as e:
            self.errors.append(e)
            joinable_row_errors = []
        line_number = self.reader.line_num
