<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def thread_helper(form_tag=True, edit_mode=False, for_moderator=False):
 """ Thread's form layout helper """

    helper = FormHelper()
    helper.form_action = '.'
    helper.attrs = {'data_abide': ''}
    helper.form_tag = form_tag
    
    fieldsets = [
        Row(
            Column(
                'subject',
                css_class='small-12'
            ),
        ),
    ]
    
    # Category field only in edit form
    if edit_mode:
        fieldsets.append(
            Row(
                Column(
                    'category',
                    css_class='small-12'
                ),
            ),
        )
    
    if for_moderator:
        fieldsets.append(
            Row(
                Column(
                    'sticky',
                    css_class='small-12 medium-4'
                ),
                Column(
                    'announce',
                    css_class='small-12 medium-4'
                ),
                Column(
                    'closed',
                    css_class='small-12 medium-4'
                ),
            ),
        )
    
    # First message is not in edit form
    if not edit_mode:
        fieldsets.append(
            Row(
                Column(
                    'text',
                    css_class='small-12'
                ),
            ),
        )
    
    if for_moderator:
        fieldsets.append(
            Row(
                Column(
                    'visible',
                    css_class='small-12'
                ),
            ),
        )
    
    # Threadwatch option is not in edit form
    if not edit_mode:
        fieldsets.append(
            Row(
                Column(
                    'threadwatch',
                    css_class='small-12'
                ),
            ),
        )
    
    fieldsets = fieldsets+[
        ButtonHolderPanel(
            Submit('submit', _('Submit')),
            css_class='text-right',
        ),
    ]
    
    helper.layout = Layout(*fieldsets)
    
    return helper