My gut tells me you'd get much better results if you tried to write D in D instead of Python in D. I might take a stab at this myself. I can see lots of improvements to the original code.