mirror of
https://github.com/MISP/misp-galaxy.git
synced 2024-12-02 19:57:20 +00:00
8 lines
219 B
Python
8 lines
219 B
Python
|
def to_string(s, encoding: str = "utf-8"):
|
||
|
if isinstance(s, str):
|
||
|
return s
|
||
|
elif isinstance(s, bytes):
|
||
|
return s.decode(encoding, "ignore")
|
||
|
else:
|
||
|
return s # Not a string we care about
|