Switch to string rsplit for python 3 compatibility