'Custom Layout Method'

@staticmethod
def layout(item):

    if (not item.authorized):
        enabled = False
        visible = False
    elif ((item.enabled is None) or item.enabled):
        enabled = True
        visible = True
    if (enabled and visible):
        if (item.parent is not None):
            if (item.enabled and item.authorized):
                if item.components:
                    _class = ''
                    if ((item.parent.parent is None) and item.selected):
                        _class = 'highlight'
                    items = item.render_components()
                    if items:
                        items = LI(UL(items, _class='menu-extention'))
                    return [LI(A(item.label, _href=item.url(), _id=item.attr._id, _class=_class)), items]
                else:
                    if (item.parent.parent is None):
                        _class = ((item.selected and 'highlight') or '')
                    else:
                        _class = '    '
                    return LI(A(item.label, _href=item.url(), _id=item.attr._id, _class=_class))
        else:
            items = item.render_components()
            return UL(items, _id='main-sub-menu', _class='sub-menu')
    else:
        return None
