def applyROIBBs(bboxes, tl, br):
    """
    Checks and keeps the detected bounding boxes only if they are fully within the ROI.

    Input:
        bboxes: List of bbox tuples

    Output:
        roi_bboxes: List of bbox tuples within ROI
    """

    if bboxes is None:
        return None
    
    roi_bboxes = []

    for bbox in bboxes:
        if bbox[0] >= tl[0] and bbox[1] >= tl[1] and bbox[2] <= br[0] and bbox[3] <= br[1]:
            roi_bboxes.append(bbox)
    
    if len(roi_bboxes) == 0:
        roi_bboxes = None
    
    return roi_bboxes