Python 3 compatibility for RNN tests