More work on porting to python 3.

More changes for python 3 compatibility.
  - changing all dict.has_key(key) to key in dict.
  - changing all key in dict.keys() to key in dict.
  - changing integer division from, e.g., 1/2 to 1//2

Test suite is still passing for python 2.7. Not yet working in
python 3.3.