First commit. Based from original spgen template serializer.