def ipaddress_from_string(ip_address_string):
 parts = ip_address_string.rsplit('%', 1)
 ip_address_string = parts[0]
 return IPAddress(ip_address_string)

def ipaddress_from_string ( ip_address_string ) : parts = ip_address_string . rsplit ( '%' , 1 ) ip_address_string = parts [ 0 ] return IPAddress ( ip_address_string )
parse an ipv4 or ipv6 address string and return an ipaddress instance .