def is_valid_ipv4(ip):
    try:
        socket.inet_pton(socket.AF_INET, ip)
    except socket.error:
        return False
    return True
Return True if the provided ip is a valid IPv4-address
dataset/ETHPy150Open openstack/swift/swift/common/ring/utils.py/is_valid_ipv4