Fix deprecated has_key(key) use

- Fixing some deprecated cases of has_key(key) to use ‘in’ instead.
- Updated ‘tests.py’ again to provide prettier output
- Formatting update on nsnitro.py