def check_overlap(bbox1, bbox2):
    """
    Checks if 2 boxes are overlapping. Also works for 2D tuples.

    Args:
        bbox1: [x1, y1, x2, y2] or [z1, z2]
        bbox2: [x1, y1, x2, y2] or [z1, z2]

    Returns:
        bool
    """
    if bbox1[0] > bbox2[2] or bbox2[0] > bbox1[2]:
        return False
    if len(bbox1) > 2:
        if bbox1[1] > bbox2[3] or bbox2[1] > bbox1[3]:
            return False
    return True