#NEWLINE# def __init__( self , port , addr = None , host = None ) : #NEWLINE# #INDENT# '\n        :param str port: port to connect to\n        :param str addr: IP address to connect to\n        :param str host: hostname to connect to\n        ' #NEWLINE# assert ( bool ( self ) ^ bool ( host ) ) #NEWLINE# self . port = struct . unpack ( '!H' , port ) [ 0 ] #NEWLINE# self . addr = addr #NEWLINE# self . host = host #NEWLINE# self . is_ipv4 = False #NEWLINE# self . is_ipv6 = False #NEWLINE# self . is_host = False #NEWLINE# if addr : #NEWLINE# #INDENT# addr = ipaddress . ip_address ( addr ) #NEWLINE# if isinstance ( addr , ipaddress . IPv4Address ) : #NEWLINE# #INDENT# self . is_ipv4 = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . is_ipv6 = True #NEWLINE# #UNINDENT# self . addr = bytes ( addr . exploded ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . is_host = True