def endpoint(text): addr, port = splitaddress(text.strip()) host = addr if ishost(addr) else ip_to_host(addr) if port is not None and not isport(port): raise ValueError(port) return host, port
def is_endpoint(value): host, port = splitaddress(value) return is_host(host) and is_port(port)
def socket(text): addr, port = splitaddress(text.strip()) ip = addr if isip(addr) else host_to_ip(addr) if port is not None and not isport(port): raise ValueError(port) return ip, port
def is_socket(value): ip, port = splitaddress(value) return isip(ip) and is_port(port)
def isendpoint(value): host, port = splitaddress(value) return ishost(host) and isport(port)
def issocket(value): ip, port = splitaddress(value) return isip(ip) and isport(port)