remove compatibility for hasattr && autopep8

`hasattr` and `next` has in > python2.6.