import codecs


def _as_unicode(s):
    """Turn byte string or unicode string into a unicode string (PRIVATE)."""
    if isinstance(s, str):
        return s
    # Assume it is a bytes string
    # Note ISO-8859-1 aka Latin-1 preserves first 256 chars
    return codecs.latin_1_decode(s)[0]