replace crappy TextIO with Magic Numbers and generator arithmetic

Zen
dozens of bugfixes

Telemetry now compiles, runs, and passes unit tests under python 2 && 3.

we still need unit tests on packet sorting; that's going to be tough.
if we're just testing the link, we can send heartbeat packets cuz those
get trashed anyway. if we want to test actual (random) data, we could
move any existing DB out of the way