def _send(self, data):
        """
        Send data to statsite. Data that can not be sent will be queued.
        """
        retry = self.RETRY
        # Attempt to send any data in the queue
        while retry > 0:
            # Check socket
            if not self.socket:
                # Log Error
                self.log.error("StatsiteHandler: Socket unavailable.")
                # Attempt to restablish connection
                self._connect()
                # Decrement retry
                retry -= 1
                # Try again
                continue
            try:
                # Send data to socket
                data = data.split()
                data = data[0] + ":" + data[1] + "|kv\n"
                self.socket.sendall(data)
                # Done
                break
            except socket.error as e:
                # Log Error
                self.log.error("StatsiteHandler: Failed sending data. %s.", e)
                # Attempt to restablish connection
                self._close()
                # Decrement retry
                retry -= 1
                # try again
                continue

        Send data to statsite. Data that can not be sent will be queued.
        
src/diamond/handler/statsite.py