Merge py branch with fixes to Python bindings

This PR closes #211, which reported segfaults when using the Python bindings on OS X. The tests now run correctly without any issues on Darwin and Linux.

Because this fix required side-stepping some of the `ctypes` convenience mechanisms, some additional error/type checking may be in order. For example, in many functions optional arguments have a default value of `None`. This worked fine in Linux, but now since we're directly referencing pointer from its encapsulating Python object, we need to first check whether the object is `None` before trying to dereference. However, this is a separate concern from the initial issue reported, so I'll open up a separate thread and we can continue the discussion there.