'Layout Method (Item Renderer)'

@staticmethod
def layout(item):

    if ((not item.authorized) and (not item.opts.always_display)):
        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 None):
            number_of_links = 0
            components = []
            append = components.append
            for submenu in items:
                append(submenu)
                number_of_links += len(submenu.elements('a'))
            if (not number_of_links):
                return None
            title = (H3(item.label) if item.label else '')
            menu = DIV(title, DIV(TAG[''](components), _class='icon-bar    five-up'), _id=item.attr._id, _class=item.attr._class)
            return menu
        else:
            _class = item.attr._class
            if _class:
                _class = ('%s    item' % _class)
            else:
                _class = 'item'
            _id = item.attr._id
            icon = item.opts.icon
            if icon:
                return A(ICON(icon), LABEL(item.label), _class=_class, _href=item.url(), _id=_id)
            else:
                return A(LABEL(item.label), _class=_class, _href=item.url(), _id=_id)
    else:
        return None
