from msgpack import unpackb cdef class Credentials: def __init__(self, str email, str password): self.email = email self.password = password @staticmethod cdef from_msgpack(bytes data): unpacked = unpackb(data, strict_map_key=False) return Credentials( unpacked.get("Email"), unpacked.get("Password")) def __str__(self): return f'{self.email}: {self.password}'