def change_labeling(pix_trendline, label_rules):
    """
    Given a Trendline and a list of LabelRules

    For each label, determine if the pixel matches.  If so, output:
    {
        <label_name>: {
            'class_val': X,
            'onset_year': X,
            'magnitude': X, 
            'duration': X
        }, ...
    }
    """
    labels = {}
    for rule in label_rules:
        match = pix_trendline.match_rule(rule)
        if match:
            labels[rule.name] = {
                'class_val': rule.val,
                'onset_year': match.onset_year,
                'magnitude': match.magnitude, 
                'duration': match.duration
            }

    return labels