def interval_overlap(i1, i2):
    """
    The function judge whether two intervals overlap with each other. i1 and i2 should be list or tuple with two elements.
    We require the first element of the interval is start and the second is end. start < end. start and end are 0-based
    Return a bool. True for overlap.
    """
    if i1[0] > i1[1] or i2[0] > i2[1]:
        raise Exception('Error: not standard interval!', i1, i2)
    if i1[0] == i1[1] or i2[0] == i2[1]:
        flag = False
    else:
        flag = i1[1] > i2[0] and i1[0] < i2[1]
    return flag
