Implements kserialize functionality