Function called for text nodes

def handle_data(self, data):
        """Function called for text nodes"""
        if not self.silent:
            possible_urls = re.findall(
                r'(https?://[\w\d:#%/;$()~_?\-=\\\.&]*)', data)
            # validate possible urls
            # we'll transform them just in case
            # they are valid.
            if possible_urls and self.automatic_link_transformation:
                for url in possible_urls:
                    if regex_url.search(url):
                        transformed_url = '<a href="%s">%s</a>' % (url, url)
                        data = data.replace(url, transformed_url)
                self.result += data
            else:
                self.result += cgi.escape(data, True)