def combine_bboxes(bboxes, threshold=0.6):
    """
    If the bboxes are close together, combine them into one.
    We check this by comparing the sum of areas over the area of the combined
    bbox. If it's over a threshold, we go ahead and combine.

    Inputs:
        bboxes - list of (x0, y0, x1, y1)
        thresold - area threshold to combine
    """
    sum_areas = sum((x1-x0) * (y1-y0) for x0, y0, x1, y1 in bboxes)
    cx0 = min(x0 for x0, y0, x1, y1 in bboxes)
    cx1 = max(x1 for x0, y0, x1, y1 in bboxes)
    cy0 = min(y0 for x0, y0, x1, y1 in bboxes)
    cy1 = max(y1 for x0, y0, x1, y1 in bboxes)
    new_area = (cx1-cx0) * (cy1-cy0)
    if sum_areas / new_area > threshold:
        return [(cx0, cy0, cx1, cy1)]
    else:
        return bboxes