def _from_base_type(self, ent):
if ent._projection:<EOL><INDENT>return _projected_entity_to_message(ent, self._message_type)<EOL><DEDENT>blob = ent.blob_<EOL>if blob is not None:<EOL><INDENT>protocol = self._protocol_impl<EOL><DEDENT>else:<EOL><INDENT>protocol = None<EOL>for name in _protocols_registry.names:<EOL><INDENT>key = '<STR_LIT>' % name<EOL>if key in ent._values:<EOL><INDENT>blob = ent._values[key]<EOL>if isinstance(blob, model._BaseValue):<EOL><INDENT>blob = blob.b_val<EOL><DEDENT>protocol = _protocols_registry.lookup_by_name(name)<EOL>break<EOL><DEDENT><DEDENT><DEDENT>if blob is None or protocol is None:<EOL><INDENT>return None  <EOL><DEDENT>msg = protocol.decode_message(self._message_type, blob)<EOL>return msg<EOL>
Convert a Model instance (entity) to a Message value.