tz-backend: Add serialization wrapper