Source code for crossbar._compat
#####################################################################################
#
# Copyright (c) typedef int GmbH
# SPDX-License-Identifier: EUPL-1.2
#
#####################################################################################
[docs]
def native_string(string):
"""
Make C{string} be the type of C{str}, decoding with ASCII if required.
"""
if isinstance(string, bytes):
return string.decode("ascii")
else:
raise ValueError("This is already a native string.")