def _do_cell_alignment(self):
<EOL>widths = {}<EOL>heights = {}<EOL>for (row, col), cell in self._cells.iteritems():<EOL><INDENT>height = heights.setdefault(row, <NUM_LIT:0.0>)<EOL>heights[row] = max(height, cell.get_height())<EOL>width = widths.setdefault(col, <NUM_LIT:0.0>)<EOL>widths[col] = max(width, cell.get_width())<EOL><DEDENT>xpos = <NUM_LIT:0><EOL>lefts = {}<EOL>cols = widths.keys()<EOL>cols.sort()<EOL>for col in cols:<EOL><INDENT>lefts[col] = xpos<EOL>xpos += widths[col]<EOL><DEDENT>ypos = <NUM_LIT:0><EOL>bottoms = {}<EOL>rows = heights.keys()<EOL>rows.sort()<EOL>rows.reverse()<EOL>for row in rows:<EOL><INDENT>bottoms[row] = ypos<EOL>ypos += heights[row]<EOL><DEDENT>for (row, col), cell in self._cells.iteritems():<EOL><INDENT>cell.set_x(lefts[col])<EOL>cell.set_y(bottoms[row])<EOL><DEDENT>
Calculate row heights and column widths.

        Position cells accordingly.