'Generate a Report widget
@param r: the S3Request instance
@param widget: the widget as a tuple: (label, type, icon)
@param attr: controller attributes for the request'

def _report(self, r, widget, **attr):

    widget_get = widget.get
    context = widget_get('context', None)
    tablename = widget_get('tablename', None)
    (resource, context) = self._resolve_context(r, tablename, context)
    widget_filter = widget_get('filter', None)
    if widget_filter:
        resource.add_filter(widget_filter)
    widget_id = ('profile-report-%s-%s' % (tablename, widget['index']))
    report = S3Report()
    report.resource = resource
    ajaxurl = widget_get('ajaxurl', None)
    contents = report.widget(r, widget_id=widget_id, ajaxurl=ajaxurl, **attr)
    label = widget_get('label', '')
    if (label and isinstance(label, basestring)):
        label = current.T(label)
    icon = widget_get('icon', '')
    if icon:
        icon = ICON(icon)
    _class = self._lookup_class(r, widget)
    output = DIV(H4(icon, label, _class='profile-sub-header'), DIV(contents, _class='card-holder'), _class=_class)
    return output
