def METHOD_NAME(self, x, y):
    w, h = self.w, self.h
    tmp = [(0, x - 1, y - 1), (1, x, y - 1),
           (2, x + 1, y - 1), (3, x - 1, y),
           (4, x + 1, y), (5, x - 1, y + 1),
           (6, x, y + 1), (7, x + 1, y + 1)]
    return [i for i in tmp if i[1] >= 0 and i[1] < w and i[2] >= 0 and i[2] < h]