Source code for ipfx.py2to3
[docs]def to_str(bytes_or_str):
if isinstance(bytes_or_str, bytes):
return bytes_or_str.decode('utf-8')
else:
return bytes_or_str
[docs]def to_bytes(bytes_or_str):
if isinstance(bytes_or_str, str):
return bytes_or_str.encode('utf-8')
else:
return bytes_or_str