Tidy up

I've removed all trailing whitespace, and then made a go at quieting flake8 as much as possible.

I've reduced the number of lines output by flake8 from 631 to 25.

In the process I found one duplicated method, one questionable portion of code [defines a variable but doesn't use it], one outright error [resolver has nothing called 'node' for line 364], and that I no longer feel very comfortable using this library :/