def collapse_active_menu(self):
        """Collapse active menu and unhighlight it.

        The active menu is collapsed by resetting the
        active menu variable to None and removing the
        active branch draw method.

        The unhighlight method called on the active menu
        works recursively down the branch when the item is a
        menu.submenu.main.Menu instance.
        """
        ### remove draw active branch method from draw list
        ### (if present)

        try:
            self.draw.remove(self.draw_active_branch)
        except ValueError:
            pass

        ### check existence of unhighlight method
        try:
            method = self.active_menu.unhighlight

        ### if it doesn't exist, just pass, since it means
        ### there's currently no menu active (the active
        ### menu is None)
        except AttributeError:
            pass

        ### otherwise, execute the method and reset the
        ### active menu attribute

        else:

            method()
            self.active_menu = None
Collapse active menu and unhighlight it.

        The active menu is collapsed by resetting the
        active menu variable to None and removing the
        active branch draw method.

        The unhighlight method called on the active menu
        works recursively down the branch when the item is a
        menu.submenu.main.Menu instance.
        
nodezator/menu/behaviour.py