'Layout Method (Item Renderer)'

@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):
                attr = dict(_id=item.attr._id)
                if item.attr._onclick:
                    attr['_onclick'] = item.attr._onclick
                else:
                    attr['_href'] = item.url()
                if item.components:
                    items = item.render_components()
                    if ((not items) and (not item.link)):
                        return None
                    _class = ''
                    if ((item.parent.parent is None) and item.selected):
                        _class = 'active'
                    section = [LI(A(item.label, **attr), _class=('heading    %s' % _class))]
                    if items:
                        section.append(UL(items))
                    return section
                else:
                    if (item.parent.parent is None):
                        _class = 'heading'
                    else:
                        _class = ''
                    return LI(A(item.label, **attr), _class=_class)
        else:
            items = item.render_components()
            return DIV(NAV(UL(items, _id='main-sub-menu', _class='side-nav')), _class='sidebar')
    else:
        return None
