def intervalOverlapCheck(interval, cmprInterval, percentThreshold=0,
    timeThreshold=0, boundaryInclusive=False):
    """
    Checks whether two intervals overlap
    
    If percentThreshold is greater than 0, then if the intervals overlap, they
        must overlap by at least this threshold
    
    If timeThreshold is greater than 0, then if the intervals overlap, they
        must overlap by at least this threshold
        
    If boundaryInclusive is true, then two intervals are considered to overlap
        if they share a boundary
    """
    startTime, endTime = interval[:2]
    cmprStartTime, cmprEndTime = cmprInterval[:2]
    overlapTime = max(0, min(endTime, cmprEndTime) - max(startTime,
        cmprStartTime))
    overlapFlag = overlapTime > 0
    boundaryOverlapFlag = False
    if boundaryInclusive:
        boundaryOverlapFlag = (startTime == cmprEndTime or endTime ==
            cmprStartTime)
    percentOverlapFlag = False
    if percentThreshold > 0 and overlapFlag:
        totalTime = max(endTime, cmprEndTime) - min(startTime, cmprStartTime)
        percentOverlap = overlapTime / float(totalTime)
        percentOverlapFlag = percentOverlap >= percentThreshold
    timeOverlapFlag = False
    if timeThreshold > 0 and overlapFlag:
        timeOverlapFlag = overlapTime > timeThreshold
    overlapFlag = (overlapFlag or boundaryOverlapFlag or percentOverlapFlag or
        timeOverlapFlag)
    return overlapFlag
