Add support for Python3

`list()` is unnecessary here, because we are iterating it completely.