code: def parse_ipv6_hostname(cls, hostname):
          '''Parse and normalize a IPv6 address.'''
          if not hostname.startswith('[') or not hostname.endswith(']'):
              raise ValueError('Invalid IPv6 address: {}'
                               .format(ascii(hostname)))
  
          hostname = ipaddress.IPv6Address(hostname[1:-1]).compressed
  
          return hostnamf parse_ipv6_hostname(cls, hostname):
          '''Parse and normalize a IPv6 address.'''
          if not hostname.startswith('[') or not hostname.endswith(']'):
              raise ValueError('Invalid IPv6 address: {}'
                               .format(ascii(hostname)))
  
          hostname = ipaddress.IPv6Address(hostname[1:-1]).compressed
  
          return hostname
docs: Parse and normalize a IPv6 address.