Add explicit cast of iterator to list for python 3 compatibility