code: def write(self, data):
          
          bytes_sent = 0
          data_mv = memoryview(data)
          payload_size = len(data_mv)
          while bytes_sent < payload_size:
              try:
                  bytes_sent += self.send(
                      data_mv[bytes_sent:bytes_sent + SOCK_WRITE_BLOCKSIZE],
                  )
              except socket.error as e:
                  if e.args[0] not in errors.socket_errors_nonblocking:
                      raise
docs: Sendall for non-blocking sockets.