#NEWLINE# def inet_pton( address_family , ip_string ) : #NEWLINE# #INDENT# if ( address_family == socket . AF_INET ) : #NEWLINE# #INDENT# return socket . inet_aton ( ip_string ) #NEWLINE# #UNINDENT# addr = sockaddr ( ) #NEWLINE# addr . sa_family = address_family #NEWLINE# addr_size = ctypes . c_int ( ctypes . sizeof ( addr ) ) #NEWLINE# if ( WSAStringToAddressA ( ip_string , address_family , None , ctypes . byref ( addr ) , ctypes . byref ( addr_size ) ) != 0 ) : #NEWLINE# #INDENT# raise socket . error ( ctypes . FormatError ( ) ) #NEWLINE# #UNINDENT# if ( address_family == socket . AF_INET6 ) : #NEWLINE# #INDENT# return ctypes . string_at ( addr . ipv6_addr , 16 ) #NEWLINE# #UNINDENT# raise socket . error ( 'unknown address family' )