Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def default_function(cls, v: Any) -> Any:
if isinstance(v, bytes):
return v.decode()
try:
return cls.types_default_map[type(v)](v)
except KeyError:
orjson.JSONEncodeError(v)