Use new-style exception.
Use new-style exception.
Use new-style exception.
Replace weird use of map with explicit loop.
Fix to work with Python 3.
Handle unary minus.