def check_submission(sub):
    """
    Checks that the submission meets all the requirements.
    1. No more than 22 Boxes per frame.
    2. Only one label prediction per video/frame
    3. No duplicate boxes per frame.
    4. Boxes must be within video area:
        - `top` and `left` must each be >= 0
        - The sum of `left` and `width` must be <= 1280
        - The sum of `top` and `height` must be must be <= 720
    Args:
        sub : submission dataframe.
    Returns:
        True -> Passed the tests
        False -> Failed the test
    """
    # Maximum of 22 boxes per frame.
    max_box_per_frame = sub.groupby(["video_frame"])["label"].count().max()
    if max_box_per_frame > 22:
        print("Has more than 22 boxes in a single frame")
        return False
    # Only one label allowed per frame.
    has_duplicate_labels = sub[["video_frame", "label"]].duplicated().any()
    if has_duplicate_labels:
        print("Has duplicate labels")
        return False
    # Check for unique boxes
    has_duplicate_boxes = sub[["video_frame", "left", "width", "top", "height"]].duplicated().any()
    if has_duplicate_boxes:
        print("Has duplicate boxes")
        return False
    if sub['left'].min() < 0:
        print('left column has values less than 0')
        return False
    if sub['top'].min() < 0:
        print('top column has values less than 0')
        return False
    if (sub['left'] + sub['width']).max() > 1280:
        print('left+width columns has values greater than 1280')
        return False
    if (sub['top'] + sub['height']).max() > 720:
        print('top+height columns has values greater than 720')
        return False
    return True