def get_rows_to_write(worksheet):
 rows = {}
 for ((row, col), cell) in worksheet._cells.items():
  rows.setdefault(row, []).append((col, cell))
 for row_idx in worksheet.row_dimensions:
  if (row_idx not in rows):
   rows[row_idx] = []
 return sorted(rows.items())

def get_rows_to_write ( worksheet ) : rows = { } for ( ( row , col ) , cell ) in worksheet . _cells . items ( ) : rows . setdefault ( row , [ ] ) . append ( ( col , cell ) ) for row_idx in worksheet . row_dimensions : if ( row_idx not in rows ) : rows [ row_idx ] = [ ] return sorted ( rows . items ( ) )
return all rows .