Fix error handling for python api wrapper

The title says it all.

Also included are some bonus documentation updates.