def deserialize(cls, serialized, serializer=None): serialized = convert_to_string(serialized) serializer = serializer or BinarySerializer() if serialized: return serializer.deserialize(serialized) else: raise MacaroonInitException( 'Must supply serialized macaroon.' )
def serialize(self, serializer=None): serializer = serializer or BinarySerializer() return serializer.serialize(self)