code: def publish(self, data):
          
          if self.entity_api_key == "":
              return {'status': 'failure', 'response': 'No API key found in request'}
          publish_url = self.base_url + "api/0.1.0/publish"
          publish_headers = {"apikey": self.entity_api_key}
          publish_data = {
              "exchange": "amq.topic",
              "key": str(self.entity_id),
              "body": str(data)
          }
          with self.no_ssl_verification():
              r = requests.post(publish_url, json.dumps(publish_data), headers=publish_headers)
          response = dict()
          if "No API key" in str(r.content.decode("utf-8")):
              response["status"] = "failure"
              r = json.loads(r.content.decode("utf-8"))['message']
          elif 'publish message ok' in str(r.content.decode("utf-8")):
              response["status"] = "success"
              r = r.content.decode("utf-8")
          else:
              response["status"] = "failure"
              r = r.content.decode("utf-8")
          response["response"] = str(r)
          return response
docs: This function allows an entity to publish data to the middleware.
  
          Args:
              data    (string): contents to be published by this entity.