code: def encode_message(self, message):
          
          message.check_initialized()
  
          return json.dumps(message, cls=MessageJSONEncoder,
                            protojson_protocol=self)
docs: Encode Message instance to JSON string.
  
          Args:
            Message instance to encode in to JSON string.
  
          Returns:
            String encoding of Message instance in protocol JSON format.
  
          Raises:
            messages.ValidationError if message is not initialized.