def _serialize(self, entity, pb, prefix='<STR_LIT>', parent_repeated=False,<EOL>projection=None):
values = self._get_base_value_unwrapped_as_list(entity)<EOL>name = prefix + self._name<EOL>if projection and name not in projection:<EOL><INDENT>return<EOL><DEDENT>if self._indexed:<EOL><INDENT>create_prop = lambda: pb.add_property()<EOL><DEDENT>else:<EOL><INDENT>create_prop = lambda: pb.add_raw_property()<EOL><DEDENT>if self._repeated and not values and self._write_empty_list:<EOL><INDENT>p = create_prop()<EOL>p.set_name(name)<EOL>p.set_multiple(False)<EOL>p.set_meaning(entity_pb.Property.EMPTY_LIST)<EOL>p.mutable_value()<EOL><DEDENT>else:<EOL><INDENT>for val in values:<EOL><INDENT>p = create_prop()<EOL>p.set_name(name)<EOL>p.set_multiple(self._repeated or parent_repeated)<EOL>v = p.mutable_value()<EOL>if val is not None:<EOL><INDENT>self._db_set_value(v, p, val)<EOL>if projection:<EOL><INDENT>new_p = entity_pb.Property()<EOL>new_p.set_name(p.name())<EOL>new_p.set_meaning(entity_pb.Property.INDEX_VALUE)<EOL>new_p.set_multiple(False)<EOL>new_p.mutable_value().CopyFrom(v)<EOL>p.CopyFrom(new_p)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>
Internal helper to serialize this property to a protocol buffer.

        Subclasses may override this method.

        Args:
          entity: The entity, a Model (subclass) instance.
          pb: The protocol buffer, an EntityProto instance.
          prefix: Optional name prefix used for StructuredProperty
            (if present, must end in '.').
          parent_repeated: True if the parent (or an earlier ancestor)
            is a repeated Property.
          projection: A list or tuple of strings representing the projection for
            the model instance, or None if the instance is not a projection.