def replace(<EOL>self, kb_id, qn_alist, custom_headers=None, raw=False, **operation_config):
replace_kb = models.ReplaceKbDTO(qn_alist=qn_alist)<EOL>url = self.replace.metadata['<STR_LIT:url>']<EOL>path_format_arguments = {<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", self.config.endpoint, '<STR_LIT:str>', skip_quote=True),<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", kb_id, '<STR_LIT:str>')<EOL>}<EOL>url = self._client.format_url(url, **path_format_arguments)<EOL>query_parameters = {}<EOL>header_parameters = {}<EOL>header_parameters['<STR_LIT:Content-Type>'] = '<STR_LIT>'<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>body_content = self._serialize.body(replace_kb, '<STR_LIT>')<EOL>request = self._client.put(url, query_parameters, header_parameters, body_content)<EOL>response = self._client.send(request, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT>]:<EOL><INDENT>raise models.ErrorResponseException(self._deserialize, response)<EOL><DEDENT>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(None, response)<EOL>return client_raw_response<EOL><DEDENT>
Replace knowledgebase contents.

        :param kb_id: Knowledgebase id.
        :type kb_id: str
        :param qn_alist: List of Q-A (QnADTO) to be added to the
         knowledgebase. Q-A Ids are assigned by the service and should be
         omitted.
        :type qn_alist:
         list[~azure.cognitiveservices.knowledge.qnamaker.models.QnADTO]
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: None or ClientRawResponse if raw=true
        :rtype: None or ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ErrorResponseException<azure.cognitiveservices.knowledge.qnamaker.models.ErrorResponseException>`