import socket


def is_ipv4_addr(candidate):
    """Check a string to see if it is a valid v4 ip address

    :param candidate: string to check
    :return boolean
    """

    try:
        socket.inet_pton(socket.AF_INET, candidate)
        return True
    except socket.error:
        return False