def ccw_or_cw_segments(segment_a, segment_b, precision=None):
    """
    Return orientation for two consecutive segments. The second coordinate in segment A must be the same
    that the first segment B coordinate.
    This orientation is given in relation to a north-south-east-west oriented axis.

    This function is inspired from  : https://www.toptal.com/python/computational-geometry-in-python-from-theory-to-implementation

    :param:
    :segment_a: (list/tuple) first segment (last point must be same that second segment (segment_b))
    :segment_b: (list/tuple) second segment (first point must be same that first segment (segment_a))
    :return: - 'CCW': counter clock wise
             - 'CW': clock wise
             - 'NEITHER' : same direction
    """
    if segment_a[1][0] == segment_b[0][0] and segment_a[1][1] == segment_b[0][1
        ]:
        pt_a_x, pt_a_y = segment_a[0]
        pt_b_x, pt_b_y = segment_a[1]
        pt_c_x, pt_c_y = segment_b[1]
        slope_a = (pt_b_x - pt_a_x) * (pt_c_y - pt_a_y)
        slope_b = (pt_b_y - pt_a_y) * (pt_c_x - pt_a_x)
        if slope_a == slope_b:
            return 'NEITHER'
        elif slope_a > slope_b:
            return 'CCW'
        else:
            return 'CW'
