import socket


def reverse_dns(address: str) -> str:
    """Attempt to resolve an IP address to its DNS name.

    :param address: The IP address to resolve
    :return: The IP's DNS name as a string
    """
    try:
        result = socket.gethostbyaddr(address)[0]
    except socket.herror:
        result = address
    return result