def pointInPolygon(pXY, xy):
    """Needs a doc string"""
    Inside = False
    N = len(pXY)
    p1x, p1y = pXY[0]
    for i in range(N + 1):
        p2x, p2y = pXY[i % N]
        if max(p1y, p2y) >= xy[1] > min(p1y, p2y) and xy[0] <= max(p1x, p2x):
            if p1y != p2y:
                xinters = (xy[1] - p1y) * (p2x - p1x) / (p2y - p1y) + p1x
            if p1x == p2x or xy[0] <= xinters:
                Inside = not Inside
        p1x, p1y = p2x, p2y
    return Inside
