def send_pending_requests(self):
        """Attempts to send pending requests messages via blocking IO
        If all requests have been sent, return True
        Otherwise, if the socket is blocked and there are more bytes to send,
        return False.
        """
        try:
            with self._lock:
                if not self._can_send_recv():
                    return False
                data = self._protocol.send_bytes()
                total_bytes = self._send_bytes_blocking(data)

            if self._sensors:
                self._sensors.bytes_sent.record(total_bytes)
            return True

        except (ConnectionError, TimeoutError) as e:
            log.exception("%s: Error sending request data", self)
            error = Errors.KafkaConnectionError("%s: %s" % (self, e))
            self.close(error=error)
            return False
Attempts to send pending requests messages via blocking IO
        If all requests have been sent, return True
        Otherwise, if the socket is blocked and there are more bytes to send,
        return False.
        
kafka/conn.py