def isLeft(P0, P1, P2):
    """
    Tests if testpoint (P2) is to the left/on/right of an infinite line passing through
    point0 (P0) and point1 (P1).  Returns:
    >0 for left of line
    =0 for on line
    <0 for right of line
    """
    x = 0
    y = 1  # Just to convert x and y into indices 0 and 1
    value = ((P1[x] - P0[x]) * (P2[y] - P0[y]) - (P2[x] - P0[x]) * (P1[y] - P0[y]))
    return value