improve compatibility for python 3

- make TransformerIterator iterable
- remove comparison "None > 0"
- use six.text_type instead of unicode
- use six.moves.reduce
- use operator module instead of lambda function
- remove some unused import