Template based tuple serializer.