def _set_value(self, entity, value):
if entity._projection:<EOL><INDENT>raise ReadonlyPropertyError(<EOL>'<STR_LIT>')<EOL><DEDENT>if self._repeated:<EOL><INDENT>if not isinstance(value, (list, tuple, set, frozenset)):<EOL><INDENT>raise datastore_errors.BadValueError('<STR_LIT>' %<EOL>(value,))<EOL><DEDENT>value = [self._do_validate(v) for v in value]<EOL><DEDENT>else:<EOL><INDENT>if value is not None:<EOL><INDENT>value = self._do_validate(value)<EOL><DEDENT><DEDENT>self._store_value(entity, value)<EOL>
Internal helper to set a value in an entity for a Property.

        This performs validation first.  For a repeated Property the value
        should be a list.