'Follow a fragment chain to try find a match
:type fragment: caper.objects.CaperFragment
:type group_name: str or None
:return: The weight of the match found between 0.0 and 1.0,
where 1.0 means perfect match and 0.0 means no match
:rtype: (float, dict, int)'

def fragment_match(self, fragment, group_name=None):

    (group_name, weight_groups) = self.find_group(group_name)
    for (weight, patterns) in weight_groups:
        for pattern in patterns:
            cur_fragment = fragment
            success = True
            result = {}
            if (len(pattern) < 1):
                break
            for fragment_pattern in pattern:
                if (not cur_fragment):
                    success = False
                    break
                match = fragment_pattern.match(cur_fragment.value)
                if match:
                    update_dict(result, match.groupdict())
                else:
                    success = False
                    break
                cur_fragment = (cur_fragment.right if cur_fragment else None)
            if success:
                Logr.debug(('Found    match    with    weight    %s' % weight))
                return (float(weight), result, len(pattern))
    return (0.0, None, 1)
