code: def send_message(
          self, request: str, response_expected: bool, **kwargs: Any
      ) -> Response:
          
          payload = str(request) + self.delimiter
          self.socket.send(payload.encode(self.encoding))
  
          response = bytes()
          decoded = None
  
          # Receive the response until we find the delimiter.
          # TODO Do not wait for a response if the message sent is a notification.
          while True:
              response += self.socket.recv(1024)
  
              decoded = response.decode(self.encoding)
              if len(decoded) < self.delimiter_length:
                  continue
  
              # TODO Check that're not in the middle of the response.
              elif decoded[-self.delimiter_length :] == self.delimiter:
                  break
  
          assert decoded is not None
          return Response(decoded[: -self.delimiter_length])
docs: Transport the message to the server and return the response.
  
          Args:
              request: The JSON-RPC request string.
              response_expected: Whether the request expects a response.
  
          Returns:
              A Response object.