'generates a TABLE tag, including INPUT checkboxes (multiple allowed)
see also: :meth:`FormWidget.widget`'

@classmethod
def widget(cls, field, value, **attributes):

    values = (((not isinstance(value, (list, tuple))) and [value]) or value)
    values = [str(v) for v in values]
    attr = OptionsWidget._attributes(field, {}, **attributes)
    attr['_class'] = 'checkboxes-widget-s3'
    requires = field.requires
    if (not isinstance(requires, (list, tuple))):
        requires = [requires]
    if hasattr(requires[0], 'options'):
        options = requires[0].options()
    else:
        raise SyntaxError, ('widget    cannot    determine    options    of    %s' % field)
    options = [(k, v) for (k, v) in options if (k != '')]
    options_help = attributes.get('options_help', {})
    input_index = attributes.get('start_at', 0)
    opts = []
    cols = attributes.get('cols', 1)
    totals = len(options)
    mods = (totals % cols)
    rows = (totals / cols)
    if mods:
        rows += 1
    if (totals == 0):
        T = current.T
        opts.append(TR(TD(SPAN(T('no    options    available'), _class='no-options-available'), INPUT(_name=field.name, _class='hide', _value=None))))
    for r_index in range(rows):
        tds = []
        for (k, v) in options[(r_index * cols):((r_index + 1) * cols)]:
            input_id = ('id-%s-%s' % (field.name, input_index))
            option_help = options_help.get(str(k), '')
            if option_help:
                label = LABEL(v, _for=input_id, _title=option_help)
            else:
                label = LABEL(v, _for=input_id)
            tds.append(TD(INPUT(_type='checkbox', _name=field.name, _id=input_id, _class=('' if v else 'hide'), requires=attr.get('requires', None), hideerror=True, _value=k, value=(str(k) in values)), label))
            input_index += 1
        opts.append(TR(tds))
    if opts:
        opts[(-1)][0][0]['hideerror'] = False
    return TABLE(*opts, **attr)
