Support for python3. Thanks to @koorgoo