Rewriting in sexy Python