def getnameinfo(sockaddr, flags=0, timeout=30):
    """Resolve a socket address *sockaddr* back to a ``(node, service)`` tuple.

    The *flags* argument can be used to modify the resolution process. See the
    :func:`socket.getnameinfo` function for more information.

    The address resolution is performed in the libuv thread pool.
    """
    hub = get_hub()
    with switch_back(timeout) as switcher:
        request = pyuv.dns.getnameinfo(hub.loop, sockaddr, flags, callback=switcher)
        switcher.add_cleanup(request.cancel)
        result = hub.switch()
    result, error = result[0]
    if error:
        message = pyuv.errno.strerror(error)
        raise pyuv.error.UVError(error, message)
    return result