def intersection_box(box1, box2):
        """
        Finds an intersection box that is common to both given boxes.

        :param box1: Box object 1
        :param box2: Box object 2
        :return: None if there is no intersection otherwise the new Box
        """
        b1_x2, b1_y2 = box1.bottom_right()
        b2_x2, b2_y2 = box2.bottom_right()

        x, y = max(box1.x, box2.x), max(box1.y, box2.y)
        x2, y2 = min(b1_x2, b2_x2), min(b1_y2, b2_y2)
        w, h = max(0, x2-x), max(0, y2-y)
        return Box(x, y, w, h)
def intersection_box ( box1 , box2 ) : b1_x2 , b1_y2 = box1 . bottom_right ( ) b2_x2 , b2_y2 = box2 . bottom_right ( ) x , y = max ( box1 . x , box2 . x ) , max ( box1 . y , box2 . y ) x2 , y2 = min ( b1_x2 , b2_x2 ) , min ( b1_y2 , b2_y2 ) w , h = max ( 0 , x2 - x ) , max ( 0 , y2 - y ) return Box ( x , y , w , h )
Finds an intersection box that is common to both given boxes.

        :param box1: Box object 1
        :param box2: Box object 2
        :return: None if there is no intersection otherwise the new Box