def insert_into_grid(grid, row, col, node_id):
<EOL>occupied_cell = None<EOL>try:<EOL><INDENT>occupied_cell = next(grid_cell for grid_cell in grid if grid_cell.row == row and grid_cell.col == col)<EOL><DEDENT>except StopIteration:<EOL><INDENT>pass<EOL><DEDENT>if occupied_cell:<EOL><INDENT>for grid_cell in grid:<EOL><INDENT>if grid_cell.row >= row:<EOL><INDENT>grid_cell.row += consts.Consts.width<EOL><DEDENT><DEDENT><DEDENT>grid.append(cell_class.GridCell(row, col, node_id))<EOL>
:param grid:
:param row:
:param col:
:param node_id: