Refactor network_util; use it in DHT.

* Test for private address using IPy.
* Abstract protocol in get_peer_url.
* Prefer importing modules than names.
* Drop unused imports.
* Other style fixes.
Refactor code in connection.py.

* Drop unused attributes _peer_alive and responses_received.
* Make failure cases stand out in send, send_raw and start_handshake.
* Drop PeerListener.stop.
  * Do not destroy global context arbitrarily.
  * Turn TransportLayer.shutdown into abstract method.
* Straighten PeerListener.listen.
* Make default callbacks equal to None.
* Catch ValueErrors produced by json.loads.
* Assert the sender's guid has been initialized prior to sending.
* Remove unused import.