ai-content-maker/.venv/Lib/site-packages/srsly/msgpack/util.py

15 lines
301 B
Python

from __future__ import unicode_literals
try:
unicode
except NameError:
unicode = str
def ensure_bytes(string):
"""Ensure a string is returned as a bytes object, encoded as utf8."""
if isinstance(string, unicode):
return string.encode("utf8")
else:
return string