Fix exception-related PEP8 issues

This changeset resolves 3 PEP8 issues: It addresses the following
exception-related PEP8 violation:
- W602 deprecated form of raising exception