def METHOD_NAME(self, rest_key, json_key):
    def handel_role(rest_text):
        def re_sub(match):
            key = match.group(1)
            if self.data is None or json_key not in self.data or key not in self.data[json_key]:
                return self.url(key, {'title': '', 'link': f'search.html?q={key}&check_keywords=yes&area=default'})
            return self.url(key, self.data[json_key][key])
        return re.sub(f':{rest_key}:' + r'`(.+?)`', re_sub, rest_text)
    return handel_role