mirror of
https://github.com/MISP/misp-galaxy.git
synced 2024-12-02 11:47:18 +00:00
7 lines
219 B
Python
7 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
|