(line1, line2)
return angle
If both lines have same orientation, return 180 If one of the lines is zero,
    exception for that If both the lines are on same side of the horizontal plane,
    calculate 180-(sumOfOrientation) If both the lines are on same side of the vertical
    plane, calculate pointSetAngle
If both lines have same orientation, return 180 If one of the lines is zero,
    exception for that If both the lines are on same side of the horizontal plane,
    calculate 180-(sumOfOrientation) If both the lines are on same side of the vertical
    plane, calculate pointSetAngle
If both lines have same orientation return 180 If one of the lines is zero exception for that If both the lines are on same side of the horizontal plane calculate 180 - ( sumOfOrientation ) If both the lines are on same side of the vertical plane calculate pointSetAngle
def _angle_between_two_lines(line1, line2):
    l1p1, l1p2 = line1
    l2p1, l2p2 = line2
    l1orien = _compute_orientation(line1)
    l2orien = _compute_orientation(line2)
    """
    If both lines have same orientation, return 180 If one of the lines is zero,
    exception for that If both the lines are on same side of the horizontal plane,
    calculate 180-(sumOfOrientation) If both the lines are on same side of the vertical
    plane, calculate pointSetAngle
    """
    if l1orien == l2orien:
        angle = 180
    elif (l1orien == 0) or (l2orien == 0):
        angle = _points_set_angle(line1, line2)

    elif l1p1 == l2p1:
        if ((l1p1[1] > l1p2[1]) and (l1p1[1] > l2p2[1])) or (
            (l1p1[1] < l1p2[1]) and (l1p1[1] < l2p2[1])
        ):
            angle = 180 - (abs(l1orien) + abs(l2orien))
        else:
            angle = _points_set_angle([l1p1, l1p2], [l2p1, l2p2])
    elif l1p1 == l2p2:
        if ((l1p1[1] > l2p1[1]) and (l1p1[1] > l1p2[1])) or (
            (l1p1[1] < l2p1[1]) and (l1p1[1] < l1p2[1])
        ):
            angle = 180 - (abs(l1orien) + abs(l2orien))
        else:
            angle = _points_set_angle([l1p1, l1p2], [l2p2, l2p1])
    elif l1p2 == l2p1:
        if ((l1p2[1] > l1p1[1]) and (l1p2[1] > l2p2[1])) or (
            (l1p2[1] < l1p1[1]) and (l1p2[1] < l2p2[1])
        ):
            angle = 180 - (abs(l1orien) + abs(l2orien))
        else:
            angle = _points_set_angle([l1p2, l1p1], [l2p1, l2p2])
    elif l1p2 == l2p2:
        if ((l1p2[1] > l1p1[1]) and (l1p2[1] > l2p1[1])) or (
            (l1p2[1] < l1p1[1]) and (l1p2[1] < l2p1[1])
        ):
            angle = 180 - (abs(l1orien) + abs(l2orien))
        else:
            angle = _points_set_angle([l1p2, l1p1], [l2p2, l2p1])
    return angle
def _angle_between_two_lines ( line1 , line2 ) : l1p1 , l1p2 = line1 l2p1 , l2p2 = line2 l1orien = _compute_orientation ( line1 ) l2orien = _compute_orientation ( line2 ) if l1orien == l2orien : angle = 180 elif ( l1orien == 0 ) or ( l2orien == 0 ) : angle = _points_set_angle ( line1 , line2 ) elif l1p1 == l2p1 : if ( ( l1p1 [ 1 ] > l1p2 [ 1 ] ) and ( l1p1 [ 1 ] > l2p2 [ 1 ] ) ) or ( ( l1p1 [ 1 ] < l1p2 [ 1 ] ) and ( l1p1 [ 1 ] < l2p2 [ 1 ] ) ) : angle = 180 - ( abs ( l1orien ) + abs ( l2orien ) ) else : angle = _points_set_angle ( [ l1p1 , l1p2 ] , [ l2p1 , l2p2 ] ) elif l1p1 == l2p2 : if ( ( l1p1 [ 1 ] > l2p1 [ 1 ] ) and ( l1p1 [ 1 ] > l1p2 [ 1 ] ) ) or ( ( l1p1 [ 1 ] < l2p1 [ 1 ] ) and ( l1p1 [ 1 ] < l1p2 [ 1 ] ) ) : angle = 180 - ( abs ( l1orien ) + abs ( l2orien ) ) else : angle = _points_set_angle ( [ l1p1 , l1p2 ] , [ l2p2 , l2p1 ] ) elif l1p2 == l2p1 : if ( ( l1p2 [ 1 ] > l1p1 [ 1 ] ) and ( l1p2 [ 1 ] > l2p2 [ 1 ] ) ) or ( ( l1p2 [ 1 ] < l1p1 [ 1 ] ) and ( l1p2 [ 1 ] < l2p2 [ 1 ] ) ) : angle = 180 - ( abs ( l1orien ) + abs ( l2orien ) ) else : angle = _points_set_angle ( [ l1p2 , l1p1 ] , [ l2p1 , l2p2 ] ) elif l1p2 == l2p2 : if ( ( l1p2 [ 1 ] > l1p1 [ 1 ] ) and ( l1p2 [ 1 ] > l2p1 [ 1 ] ) ) or ( ( l1p2 [ 1 ] < l1p1 [ 1 ] ) and ( l1p2 [ 1 ] < l2p1 [ 1 ] ) ) : angle = 180 - ( abs ( l1orien ) + abs ( l2orien ) ) else : angle = _points_set_angle ( [ l1p2 , l1p1 ] , [ l2p2 , l2p1 ] ) return angle