Trying to fix DeprecationWarning with encodestring