A terribly messy Python implementation of stephencelis' GHI