The address family is chosen based on the address tuple length - ipv6 addresses are normally represented as (host, port, flowinfo, scopeid) tuple, so len(address) looks like a possible way to check if we're dealing with ipv6.
633c011