cleaned up style to be more pythonic

Going through my old changeset and incrementally making small changes (since I don't have test data yet)

- As for PEP8, removed comparisons of None via == or !=, use 'is' or 'is not' instead
- Use try/except or raise instead of assert as, when running python with -O, any validation that relies on assert will disappear
- Renamed id to id_ to avoid overriding python builtin id()