Code and notes from David Beazley's "Generator Tricks For Systems Programmers"