Style fixes

* use isinstance instead of type(<object>)
* use named exceptions rather than assert for a bad argument from the caller
* put pass on the next line