2.fix for python2
2. refactor to more generic method instead of aws method 3. ready for release to pypi