human
Complete this python program:
def checkstyle(registry, xml_parent, data):
assistant
#Here is the Python program you requested.

    """yaml: checkstyle
    Publish trend reports with Checkstyle.
    Requires the Jenkins :jenkins-wiki:`Checkstyle Plugin <Checkstyle+Plugin>`.
    The checkstyle component accepts a dictionary with the
    following values:
    :arg str pattern: Report filename pattern (default \\)
    :arg bool can-run-on-failed: Also runs for failed builds, instead of just
    stable or unstable builds (default false)
    :arg bool should-detect-modules: Determines if Ant or Maven modules should
    be detected for all files that contain warnings (default false)
    :arg int healthy: Sunny threshold (default \\)
    :arg int unhealthy: Stormy threshold (default \\)
    :arg str health-threshold: Threshold priority for health status
    (\low\, \normal\ or \high\) (default \low\)
    :arg dict thresholds: Mark build as failed or unstable if the number of
    errors exceeds a threshold. (optional)
    :thresholds:
    * **unstable** (`dict`)
    :unstable: * **total-all** (`int`)
    * **total-high** (`int`)
    * **total-normal** (`int`)
    * **total-low** (`int`)
    * **new-all** (`int`)
    * **new-high** (`int`)
    * **new-normal** (`int`)
    * **new-low** (`int`)
    * **failed** (`dict`)
    :failed: * **total-all** (`int`)
    * **total-high** (`int`)
    * **total-normal** (`int`)
    * **total-low** (`int`)
    * **new-all** (`int`)
    * **new-high** (`int`)
    * **new-normal** (`int`)
    * **new-low** (`int`)
    :arg str default-encoding: Encoding for parsing or showing files
    (default \\)
    :arg bool do-not-resolve-relative-paths: (default false)
    :arg bool dont-compute-new: If set to false, computes new warnings based on
    the reference build (default true)
    :arg bool use-previous-build-as-reference: determines whether to always
    use the previous build as the reference build (default false)
    :arg bool use-stable-build-as-reference: The number of new warnings will be
    calculated based on the last stable build, allowing reverts of unstable
    builds where the number of warnings was..."""
    def convert_settings(lookup, data):
        'Helper    to    convert    settings    from    one    key    to    another\n                                '
        for old_key in list(data.keys()):
            if (old_key in lookup):
                data.setdefault(lookup[old_key], data[old_key])
                del data[old_key]
    checkstyle = XML.SubElement(xml_parent, 'hudson.plugins.checkstyle.CheckStylePublisher')
    checkstyle.set('plugin', 'checkstyle')
    convert_settings({'unHealthy': 'unhealthy', 'healthThreshold': 'health-threshold', 'defaultEncoding': 'default-encoding', 'canRunOnFailed': 'can-run-on-failed', 'shouldDetectModules': 'should-detect-modules'}, data)
    threshold_data = data.get('thresholds', {})
    for threshold in ['unstable', 'failed']:
        convert_settings({'totalAll': 'total-all', 'totalHigh': 'total-high', 'totalNormal': 'total-normal', 'totalLow': 'total-low'}, threshold_data.get(threshold, {}))
    helpers.build_trends_publisher('[CHECKSTYLE]    ', checkstyle, data)