def get_adjacent_cells(self, x_coord, y_coord):
    result = {}
for x, y in [(x_coord + i, y_coord + j) for i in (-1, 0, 1) for j in (-1, 0,
    1) if i != 0 or j != 0]:
    if (x, y) in grid.cells:
        result[x, y] = grid.cells[x, y]
Pythonic and efficient way of finding adjacent cells in grid