[Do not merge, WIP] Remove dead code

### Motivation
Yesterday I discovered [vulture](https://pypi.python.org/pypi/vulture), a static analysis tool that detects unused code. I decided to run it on our codebase; this PR is a conservative interpretation of the output, which contains many false positives.

### Changelog
* Remove unused code from various modules.
* (TODO) Remove unused variables and attributes.

### Problem
It bothers me that some of the removed code (especially in the `dht` and `orders` modules) looks like it should be part of the **core** functionality. There is something amiss here, so I am posting this for thorough review. If critical code is indeed unused, this should be fixed right away.