Added Python 2 compatibility.