<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def reverse(self, matching_name, **kwargs):
 """ Getting a matching name and URL args and return a corresponded URL """

        for record in self.matching_records:
            if record.name == matching_name:
                path_template = record.path_template
                break
        else:
            raise NotReversed

        if path_template.wildcard_name:
            l = kwargs.get(path_template.wildcard_name)
            if not l:
                raise NotReversed
            additional_path = '/'.join(l)
            extra_path_elements = path_template.pattern.split('/')[:-1]
            pattern = join_paths('/'.join(extra_path_elements), additional_path)
        else:
            pattern = path_template.pattern

        try:
            url = pattern.format(**kwargs)
        except KeyError:
            raise NotReversed
        return url