This is unwarranted complexity.  We need to have a solid resolution (getaddrinfo), a solid fallback (socket.gethostname), or leave it to the user to set manually.