def square_boxes(boxes):
    """
    Takes bounding boxes that are almost square and makes them exactly square
    to deal with rounding errors.

    Parameters
    ----------
    boxes : list of tuple of tuple of int
        The bounding boxes to be squared.

    Returns
    -------
    boxes : list of tuple of tuple of int
        The squared version of the boxes.
    """
    for i,box in enumerate(boxes):
        #Ignore missing boxes
        if box is None:
            continue;
        x = box[1][0] - box[0][0];
        y = box[1][1] - box[0][1];
        
        if x == y:
            continue;#Box is already square   
        elif x < y:
            #x was rounded down
            boxes[i] = (box[0],(box[1][0] + 1,box[1][1]));
        else:
            #y was rounded down
            boxes[i] = (box[0],(box[1][0],box[1][1] + 1));
    return boxes;