def set_form_widgets_attrs(form, attrs):
for _, field in form.fields.items():<EOL><INDENT>attrs_ = dict(attrs)<EOL>for name, val in attrs.items():<EOL><INDENT>if hasattr(val, '<STR_LIT>'):<EOL><INDENT>attrs_[name] = val(field)<EOL><DEDENT><DEDENT>field.widget.attrs = field.widget.build_attrs(attrs_)<EOL><DEDENT>
Applies a given HTML attributes to each field widget of a given form.

    Example:

        set_form_widgets_attrs(my_form, {'class': 'clickable'})