@staticmethod
    def layout(item):
        """ Custom Layout Method """

        # Manage flags: hide any disabled/unauthorized items
        if not item.authorized:
            item.enabled = False
            item.visible = False
        elif item.enabled is None or item.enabled:
            item.enabled = True
            item.visible = True

        if item.enabled and item.visible:

            items = item.render_components()
            if item.parent is not None:

                classes = []

                if item.parent.parent is None:
                    # Item at the top-level?
                    toplevel = True
                    if item.opts.left:
                        classes.append("menu-left")
                    #if item.opts.right:
                    #    classes.append("menu-right")
                else:
                    toplevel = False

                if item.components:
                    classes.append("has-dropdown not-click")
                    if item.selected:
                        classes.append("active")
                    if item.opts.icon:
                        classes.append("label-icon")
                        title = item.label
                        item.label = ICON(item.opts.icon)
                    else:
                        title = None
                    _class = " ".join(classes)

                    # Menu item with Dropdown
                    if item.get_first(enabled=True):
                        _href = item.url()
                        return LI(A(item.label,
                                    _href = _href,
                                    _id = item.attr._id,
                                    _title = title,
                                    ),
                                  UL(items,
                                     _class="dropdown"
                                     ),
                                  _class=_class,
                                  )
                else:
                    # Menu item without Drop-Down
                    if toplevel:
                        item_url = item.url()
                        if item_url == URL(c="default", f="index"):
                            classes.append("menu-home")
                        if item.selected:
                            classes.append("active")
                        _class = " ".join(classes)
                        return LI(A(item.label,
                                    _href=item_url,
                                    _id=item.attr._id,
                                    ),
                                  _class=_class,
                                  )
                    else:
                        # Submenu item
                        if isinstance(item.label, dict):
                            if "name" in item.label:
                                label = item.label["name"]
                            else:
                                return None
                        else:
                            label = item.label
                        link = A(label, _href=item.url(), _id=item.attr._id)
                        return LI(link)
            else:
                # Main menu

                right = []
                left = []
                for item in items:
                    if "menu-left" in item["_class"]:
                        item.remove_class("menu-left")
                        left.append(item)
                    else:
                        right.append(item)
                #right.reverse()
                if current.response.s3.rtl:
                    right, left = left, right
                return NAV(UL(LI(A(" ",
                                   _href=URL(c="default", f="index"),
                                   ),
                                 _class="name"
                                 ),
                              LI(A(SPAN(current.T("Menu"))),
                                 _class="toggle-topbar menu-icon",
                                 ),
                              _class="title-area",
                              ),
                           SECTION(UL(left, _class="left"),
                                   UL(right, _class="right"),
                                   _class="top-bar-section",
                                   ),
                           _class = "top-bar",
                           data = {"topbar": " "},
                           )
        else:
            return None

    # ---------------------------------------------------------------------
dataset/ETHPy150Open sahana/eden/modules/templates/MAVC/layouts.py/S3MainMenuLayout.layout/original