def _encode_idna(self, url):
        global urlparse
        if urlparse is None:
            from six.moves.urllib import parse as urlparse
        try:
            scheme, netloc, path, params, query, fragment = urlparse.urlparse(
                url)
        except __HOLE__:
            return url
        try:
            netloc = netloc.encode('idna')
            if six.text_type is str:  # Python 3
                netloc = netloc.decode('ascii')
            return str(urlparse.urlunparse((scheme, netloc,
                path, params, query, fragment)))
        except UnicodeError:
            return url
dataset/ETHPy150Open formencode/formencode/formencode/validators.py/URL._encode_idna