def cast_bytes(s, encoding='utf8'):
        if isinstance(s, unicode):
            return s.encode(encoding)
        return str(s)
cast unicode or bytes to bytes
dataset/ETHPy150Open circus-tent/circus/circus/py3compat.py/cast_bytes