def clamp_body(self):
        """Clamp body to the boundaries rect.

        The pygame.Rect.clamp_ip method ensures that a
        pygame.Rect instance is inside another one by moving
        it if needed. Here we use it to ensure the body of
        the menu is inside the boundaries rect.

        Extreme case: if the body of the menu is larger than
        the boundaries the clamp operation aligns the center
        of the menu body with the center of the boundaries.

        This is not the intended behaviour, but the way the
        clamp_ip method of the pygame.Rect class naturally
        deals with this kind of problem and is kept since it
        is the most reasonable behaviour for this situation.

        This extreme case however only happens when you use a
        font size extremely big and most likely unreasonable,
        font sizes, so this clamping feature is safe for
        everyday usage. For additional information about
        font sizes and clamping, check the docstring of the
        menu/common.py module.
        """
        ### fetch boundaries rect from the menu manager
        boundaries_rect = get_boundaries(self)

        ### store the left and topleft of the body
        left, _ = topleft = self.body.rect.topleft

        ### clamp the body
        self.body.rect.clamp_ip(boundaries_rect)

        ### if the body's position didn't change, cancel the
        ### execution of the rest of the method by returning
        ### early since no extra adjustments are needed
        if self.body.rect.topleft == topleft:
            return

        ### if the body is to the left of its original
        ### position, though, perform extra adjustements

        if self.body.rect.left < left:

            ### align its right coordinate to the left
            ### coordinate of the pygame.Rect instance in the
            ### 'rect' attribute
            self.body.rect.right = self.rect.left

            ### admin task: offset body just a bit to the
            ### right; this is to keep the symmetry between
            ### menus laying on left and menus laying on the
            ### right side of the rect in the 'rect'
            ### attribute, since menus laying on the right
            ### side also are also moved one pixel in the
            ### opposite direction in the reposition_body
            ### method; this is a minor usability measure to
            ### keep expanded menu's bodies just a bit in
            ### front of the menu label
            self.body.rect.move_ip(1, 0)

            ### finally clamp the body again just to be sure
            ### the moving operation above didn't bring it
            ### outside the boundaries rect again
            self.body.rect.clamp_ip(boundaries_rect)
Clamp body to the boundaries rect.

        The pygame.Rect.clamp_ip method ensures that a
        pygame.Rect instance is inside another one by moving
        it if needed. Here we use it to ensure the body of
        the menu is inside the boundaries rect.

        Extreme case: if the body of the menu is larger than
        the boundaries the clamp operation aligns the center
        of the menu body with the center of the boundaries.

        This is not the intended behaviour, but the way the
        clamp_ip method of the pygame.Rect class naturally
        deals with this kind of problem and is kept since it
        is the most reasonable behaviour for this situation.

        This extreme case however only happens when you use a
        font size extremely big and most likely unreasonable,
        font sizes, so this clamping feature is safe for
        everyday usage. For additional information about
        font sizes and clamping, check the docstring of the
        menu/common.py module.
        
nodezator/menu/submenu/main.py