human
Here's a good function header given the following:
I wrote the below code

    '\n                Initialize    the    workflow\n                '
    getstats = pe.Workflow(name=name)
    '\n                Define    the    inputs    to    the    workflow.\n                '
    if withreg:
        inputnode = pe.Node(niu.IdentityInterface(fields=['source_file', 'label_file', 'reg_file', 'subjects_dir']), name='inputspec')
    else:
        inputnode = pe.Node(niu.IdentityInterface(fields=['source_file', 'label_file']), name='inputspec')
    statnode = pe.MapNode(fs.SegStats(), iterfield=['segmentation_file', 'in_file'], name='segstats')
    '\n                Convert    between    source    and    label    spaces    if    registration    info    is    provided\n\n                '
    if withreg:
        voltransform = pe.MapNode(fs.ApplyVolTransform(inverse=True), iterfield=['source_file', 'reg_file'], name='transform')
        getstats.connect(inputnode, 'reg_file', voltransform, 'reg_file')
        getstats.connect(inputnode, 'source_file', voltransform, 'source_file')
        getstats.connect(inputnode, 'label_file', voltransform, 'target_file')
        getstats.connect(inputnode, 'subjects_dir', voltransform, 'subjects_dir')
        def switch_labels(inverse, transform_output, source_file, label_file):
            if inverse:
                return (transform_output, source_file)
            else:
                return (label_file, transform_output)
        chooser = pe.MapNode(niu.Function(input_names=['inverse', 'transform_output', 'source_file', 'label_file'], output_names=['label_file', 'source_file'], function=switch_labels), iterfield=['transform_output', 'source_file'], name='chooser')
        getstats.connect(inputnode, 'source_file', chooser, 'source_file')
        getstats.connect(inputnode, 'label_file', chooser, 'label_file')
        getstats.connect(inputnode, 'inverse', chooser, 'inverse')
        getstats.connect(voltransform, 'transformed_file', chooser, 'transform_output')
        getstats.connect(chooser, 'label_file', statnode, 'segmentation_file')
       ...

What's a good function header?
assistant
#Here's a good function header.

def create_get_stats_flow(name='getstats', withreg=False):