human
I wrote the below code

    def get_compare_type(xml_tag, compare_type):
        valid_compare_types = ['PLAIN', 'ANT', 'REG_EXP']
        if (compare_type not in valid_compare_types):
            raise InvalidAttributeError(xml_tag, compare_type, valid_compare_types)
        return compare_type
    gerrit_handle_legacy_configuration(data)
    projects = data.get('projects', [])
    gtrig = XML.SubElement(xml_parent, 'com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger')
    XML.SubElement(gtrig, 'spec')
    gprojects = XML.SubElement(gtrig, 'gerritProjects')
    for project in projects:
        gproj = XML.SubElement(gprojects, 'com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject')
        XML.SubElement(gproj, 'compareType').text = get_compare_type('project-compare-type', project.get('project-compare-type', 'PLAIN'))
        XML.SubElement(gproj, 'pattern').text = project['project-pattern']
        branches = XML.SubElement(gproj, 'branches')
        project_branches = project.get('branches', [])
        if (('branch-compare-type' in project) and ('branch-pattern' in project)):
            warning = 'branch-compare-type    and    branch-pattern    at    project    level    are    deprecated    and    support    will    be    removed    in    a    later    version    of    Jenkins    Job    Builder.
   '
            if project_branches:
                warning += 'discarding    values    and    using    values    from    branches    section'
            else:
                warning += 'please    use    branches    section    instead'
            logger.warning(warning)
        if (not project_branches):
            project_branches = [{'branch-compare-type': project.get('branch-compare-type', 'PLAIN'), 'branch-pattern': project['branch-pattern']}]
        for branch in project_branches:
            gbranch = XML.SubElement(branches, 'com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch')
            XML.SubElement(gbranch, 'compareType').text =...

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

def gerrit(registry, xml_parent, data):