Upgrade to 3.8

Kudos on the extension. I've made a couple of changes so it works with 3.8. *I haven't been able to test it with 3.6, though.*

P.S. What's up with the indentation? I get sometimes tabs, sometimes spaces. Tried to keep it as similar to the original as possible.