def label_tag(self, contents=None, attrs=None):
        contents = contents or conditional_escape(self.label)
        widget = self.field.widget
        id_ = widget.attrs.get('id') or self.auto_id
        if id_:
            attrs = attrs and flatatt(attrs) or ''
            contents = u'<label for="%s"%s>%s</label>' % (widget.id_for_label(id_), attrs, unicode(contents))
        return mark_safe(contents)
Wraps the given contents in a <label>, if the field has an ID attribute.
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/django/forms/forms.py/BoundField.label_tag