add py3 support

1. add py3k support while stay compatiable with py2k
2. fixed 2 failed tests
3. refine coding style based on PEP8
4. added travis ci config, you can enable it in your repo settings, here is a demo of my repo: https://travis-ci.org/lxyu/d3py