Cleanup bindings

I pulled some common code out of the binding files and did some cleanup similar to what was done on python-stix. Everything should still work. 

This is a prerequisite to some of the things we want to consolidate, like Unicode processing.