#NEWLINE# @ transformer ( 'for' , ( 'label' , ) ) #NEWLINE# @ defaults ( { #NEWLINE# #INDENT# 'auto_for' : False , #NEWLINE# #UNINDENT# } ) #NEWLINE# def transform_for( tagname , attributes , contents , context , bind ) : #NEWLINE# #INDENT# ( proceed , forced ) = _pop_toggle ( 'auto_for' , attributes , context ) #NEWLINE# if ( ( not proceed ) or ( bind is None ) ) : #NEWLINE# #INDENT# return forced #NEWLINE# #UNINDENT# current = attributes . get ( 'for' ) #NEWLINE# if ( forced or ( ( current is None ) and ( tagname in _auto_tags [ 'for' ] ) ) ) : #NEWLINE# #INDENT# raw_id = _generate_raw_domid ( tagname , attributes , bind ) #NEWLINE# if raw_id : #NEWLINE# #INDENT# fmt = context [ 'domid_format' ] #NEWLINE# attributes [ 'for' ] = ( fmt % raw_id ) #NEWLINE# #UNINDENT# #UNINDENT# return contents