Clean up unused imports and import *.  Add _all_ at top level.

Using import * makes it much harder to reason about the code, both for
humans and for tools kike pyflakes, so it's best avoided.

However, it's good to support use of import * for libraries; it's
particularly useful for use from a repl; __all__ ensures that only the
right symbols get exported by import *, and stops pyflakes complaining
that the imports were unused.