def _dnsname_to_stdlib(name):
 def idna_encode(name):
  "\n        Borrowed wholesale from the Python Cryptography Project. It turns out\n        that we can't just safely call `idna.encode`: it can explode for\n        wildcard names. This avoids that problem.\n        "
  import idna
  for prefix in [u'*.', u'.']:
   if name.startswith(prefix):
    name = name[len(prefix):]
    return (prefix.encode('ascii') + idna.encode(name))
  return idna.encode(name)
 name = idna_encode(name)
 if (sys.version_info >= (3, 0)):
  name = name.decode('utf-8')
 return name

def _dnsname_to_stdlib ( name ) : def idna_encode ( name ) : import idna for prefix in [ u'*.' , u'.' ] : if name . startswith ( prefix ) : name = name [ len ( prefix ) : ] return ( prefix . encode ( 'ascii' ) + idna . encode ( name ) ) return idna . encode ( name ) name = idna_encode ( name ) if ( sys . version_info >= ( 3 , 0 ) ) : name = name . decode ( 'utf-8' ) return name
converts a dnsname subjectalternativename field to the form used by the standard library on the given python version .