import socket


def _resolve_address(name_or_address):
    """ Resolve the name or address given by the user to a valid IPv4
    address.
    """
    try:
        addr_info = socket.getaddrinfo(
            name_or_address, port=80, family=socket.AddressFamily.AF_INET)
        # The function returns a list of 5-tuples with the address as
        # a 2-tuple
        return addr_info[0][4][0]
    except Exception:
        print("The server name '{}' cannot be resolved".format(name_or_address))
        raise