def parse_ipv6_literal_host(entity, default_port):
 if (entity.find(']') == (-1)):
  raise ValueError("an IPv6 address literal must be enclosed in '[' and ']' according to RFC 2732.")
 i = entity.find(']:')
 if (i == (-1)):
  return (entity[1:(-1)], default_port)
 return (entity[1:i], entity[(i + 2):])

def parse_ipv6_literal_host ( entity , default_port ) : if ( entity . find ( ']' ) == ( - 1 ) ) : raise ValueError ( "an IPv6 address literal must be enclosed in '[' and ']' according to RFC 2732." ) i = entity . find ( ']:' ) if ( i == ( - 1 ) ) : return ( entity [ 1 : ( - 1 ) ] , default_port ) return ( entity [ 1 : i ] , entity [ ( i + 2 ) : ] )
validates an ipv6 literal host:port string .