<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def autolink(self, raw_url, is_email):
 """ Filters links generated by the ``autolink`` extension. """

        if self.check_url(raw_url):
            url = self.rewrite_url(('mailto:' if is_email else '') + raw_url)
            url = escape_html(url)
            return '<a href="%s">%s</a>' % (url, escape_html(raw_url))
        else:
            return escape_html('<%s>' % raw_url)