Use dedicated methods for access to elements and attributes

* Use default handling of dict.get(), dict.setdefault(), and getattr()
* setdefault() introduced in Python 2.0
* Call pop() methods to access and delete in one go. Method dict.pop() added
  in Python 2.3.
* Iterate using items() rather than keys() and then looking each key up
* dict.update()
* Use clear() method
Use “set” and “defaultdict” objects where appropriate

Both data types introduced in Python 2.4.
Replace has_key() method calls

The “<key> in dict()” syntax was introduced in Python 2.2.

Inspired using “2to3”.