def send_entity(self, entity):
        """
        Serializes a segment/subsegment and sends it to the X-Ray daemon
        over UDP. By default it doesn't retry on failures.

        :param entity: a trace entity to send to the X-Ray daemon
        """
        message = "%s%s%s" % (PROTOCOL_HEADER,
                              PROTOCOL_DELIMITER,
                              entity.serialize())

        log.debug("sending: %s to %s:%s." % (message, self._ip, self._port))
        self._send_data(message)
Serializes a segment/subsegment and sends it to the X-Ray daemon
        over UDP. By default it doesn't retry on failures.

        :param entity: a trace entity to send to the X-Ray daemon