code: def _sendall_with_error_handle(self, data: bytes) -> None:
      # This is a helper function for sending data in a retry fashion.
      # Similar to the sendall() function in the socket module, but with
      # an error handling in case of timeout.
      total_sent = 0
      total_data = len(data)
      while total_sent < total_data:
          start_time = time.monotonic()
          try:
              sent = self._sock.send(data)
              # sent equal to 0 indicates a closed socket
              if sent == 0:
                  raise SockClientClosedError(
                      "socket connection broken"
                  )
              total_sent += sent
              # truncate our data to save memory
              data = data[sent:]
          # we handle the timeout case for the cases when timeout is set
          # on a system level by another application
          except socket.timeout:
              # adding sleep to avoid tight loop
              delta_time = time.monotonic() - start_time
              if delta_time < self._retry_delay:
                  time.sleep(self._retry_delay - delta_time)
  
imports: import socket
  import struct
  import threading
  import time
  import uuid
  from typing import TYPE_CHECKING, Any, List, Optional
  from wandb.proto import wandb_server_pb2
  from .None import tracelog
label_desc: Use image node_id 7 for calling the SockClient obj's underlying member method code with example usage: obj._sendall_with_error_handle(data) without return types