def pointsAroundP(P, width, height):
    """ Return a list of points surround P provided that P is within the bounds of the area
    """
    Px,Py = P
    if not(Px >= 0 and Px < width and Py >= 0 and Py < height):
        return []

    result = [
        (Px-1, Py),
        (Px+1, Py),
        (Px, Py-1),
        (Px, Py+1)
    ]
    result = [p for p in result if p[0] >= 0 and p[0] < width and p[1] >= 0 and p[1] < height]
    return result