'Wraps the given contents in a <label>, if the field has an ID attribute.
contents should be \'mark_safe\'d to avoid HTML escaping. If contents
aren\'t given, uses the field\'s HTML-escaped label.
If attrs are given, they\'re used as HTML attributes on the <label> tag.
label_suffix allows overriding the form\'s label_suffix.'

def label_tag(self, contents=None, attrs=None, label_suffix=None):

    contents = (contents or self.label)
    label_suffix = (label_suffix if (label_suffix is not None) else self.form.label_suffix)
    if (label_suffix and contents and (contents[(-1)] not in _(u':?.!'))):
        contents = format_html(u'{0}{1}', contents, label_suffix)
    widget = self.field.widget
    id_ = (widget.attrs.get(u'id') or self.auto_id)
    if id_:
        id_for_label = widget.id_for_label(id_)
        if id_for_label:
            attrs = dict((attrs or {}), **{u'for': id_for_label})
        attrs = (flatatt(attrs) if attrs else u'')
        contents = format_html(u'<label{0}>{1}</label>', attrs, contents)
    else:
        contents = conditional_escape(contents)
    return mark_safe(contents)
