Render the menu into a sorted by order multi dict

def render(self):
        """ Render the menu into a sorted by order multi dict """
        menu_list = []
        menu_index = 0
        for _, menu in copy.deepcopy(self.MENU).items():
            subnav = []

            menu["kwargs"]["_id"] = str(menu_index)
            menu["kwargs"]["active"] = False
            if "visible" in menu["kwargs"]:
                menu["kwargs"]["visible"] = self._test_visibility(menu["kwargs"]["visible"])

            for s in menu["subnav"]:
                if s["title"]:
                    s["title"] = self._get_title(s["title"])

                if s["endpoint"] == request.endpoint:
                    s["active"] = True
                    menu["kwargs"]["active"] = True
                s["visible"] = self._test_visibility(s["visible"])
                menu_index += 1
                s["_id"] = str(menu_index)
                subnav.append(s)

            _kwargs = menu["kwargs"]

            if menu["title"]:
                _kwargs.update({
                    "subnav": self._sort(subnav),
                    "order": menu["order"],
                    "title": self._get_title(menu["title"])
                })
                menu_list.append(_kwargs)
            else:
                menu_list += subnav
            menu_index += 1

        return self._sort(menu_list)