Push nav data stack

def _push(self, title, view, class_name, is_class, **kwargs):
        """ Push nav data stack """

        # Set the page title
        set_view_attr(view, "title", title, cls_name=class_name)

        module_name = view.__module__
        method_name = view.__name__

        _endpoint = build_endpoint_route_name(view, "index" if is_class else method_name, class_name)
        endpoint = kwargs.pop("endpoint", _endpoint)
        kwargs.setdefault("endpoint_kwargs", {})
        order = kwargs.pop("order", 0)

        # Tags
        _nav_tags = get_view_attr(view, "nav_tags", ["default"], cls_name=class_name)
        tags = kwargs.pop("tags", _nav_tags)
        if not isinstance(tags, list):
            _ = tags
            tags = [_]
        kwargs["tags"] = tags

        # visible: accepts a bool or list of callback to execute
        visible = kwargs.pop("visible", [True])
        if not isinstance(visible, list):
            visible = [visible]

        if get_view_attr(view, "nav_visible", cls_name=class_name) is False:
            visible = False

        kwargs["view"] = view
        kwargs["visible"] = visible
        kwargs["active"] = False
        kwargs["key"] = class_name

        if is_class:  # class menu
            kwargs["endpoint"] = endpoint
            kwargs["has_subnav"] = True
        else:
            kwargs["has_subnav"] = False
            kwargs.update({
                "order": order,
                "has_subnav": False,
                "title": title,
                "endpoint": endpoint,
            })

        self._title_map[endpoint] = title

        path = "%s.%s" % (module_name, method_name if is_class else class_name)
        attach_to = kwargs.pop("attach_to", [])
        if not attach_to:
            attach_to.append(path)

        for path in attach_to:
            if path not in self.MENU:
                self.MENU[path] = {
                    "title": None,
                    "endpoint": None,
                    "endpoint_kwargs": {},
                    "order": None,
                    "subnav": [],
                    "kwargs": {}
                }

            if is_class:  # class menu
                self.MENU[path]["title"] = title
                self.MENU[path]["order"] = order
                self.MENU[path]["kwargs"] = kwargs

            else:  # sub menu
                self.MENU[path]["subnav"].append(kwargs)