Stylistic comment: can this not be `err.errno in (errno.ENETUNREACH, errno.ECONNREFUSED)`?