Use bug.__unicode__() instead of built-in unicode method for forward compatibility
Update imports

- some import updates to facilitate easy porting to python3
- remove any usage that is not available in python3, eg:
  urllib2.__version__
Make attachment data handling compatible for python3