def computeIoU(detection1, detection2):
    """
    Compute the IoU (Intersection over Union) between 2 Detections object.
    
    Parameters
    ----------
    detection1, detection2 : Boundingbox object
        Two items to compute the IoU on

    Returns
    -------
    float:
        Float between 0 and 1
        Intersection over Union value of detection1 and detection2
    """
    if not (detection1.overlaps(detection2) or
            detection1.contains(detection2) or
            detection2.contains(detection1)):
        return 0

    return detection1.intersection_over_union(detection2)