def orientation(a, b, c):
    """
    Given three points, find the orientation.
    See examples below. They are colinear(0), clockwise(1), and
    counterclockwise(2) respectively.
    c
    |
    b   b_c   c_b
    |   |       |
    a   a       a
    """ 
    val = (b.y - a.y) * (c.x - b.x) - (b.x - a.x) * (c.y - b.y) 
  
    # If equal to 0 -> colinear, >0 -> clockwise, <0 -> counterclockwise
    if val == 0:
        return 0
    elif val > 0:
        return 1
    else:
        return 2