def expand(self):
        """Collapse sibling menus then expand self."""
        ### if the parent has an 'active_menu' attribute
        ### which is False, cancel execution of the rest
        ### of the method by returning earlier
        ###
        ### in other words, returning here means that
        ### this menu is a top menu but there's no active
        ### menu, which means it mustn't expand at all

        try:
            if not self.parent.active_menu:
                return
        except AttributeError:
            pass

        ### admin task: if the 'is_expanded' attribute is
        ### set to False, reposition the body to ensure it
        ### is properly positioned within the boundaries
        if not self.is_expanded:
            self.reposition_body()

        ### collapse every sibling menu and self

        for child in self.parent.children:

            if isinstance(child, self.__class__):
                child.is_expanded = False

        ### expand self
        self.is_expanded = True
Collapse sibling menus then expand self.
nodezator/menu/submenu/main.py