def cast_unicode(s, encoding='utf8', errors='replace'):  # NOQA
        if isinstance(s, bytes):
            return s.decode(encoding, errors=errors)
        return str(s)
cast bytes or unicode to unicode.
dataset/ETHPy150Open circus-tent/circus/circus/py3compat.py/cast_unicode