Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
srsly / msgpack / util.py
Size: Mime:
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