def send_error_response(self, msgid, methodname, status_code, status_desc,
                            error_insts=None):
        """Send a CIM-XML response message back to the WBEM server that
        indicates error."""

        resp_xml = cim_xml.CIM(
            cim_xml.MESSAGE(
                cim_xml.SIMPLEEXPRSP(
                    cim_xml.EXPMETHODRESPONSE(
                        methodname,
                        cim_xml.ERROR(
                            str(status_code),
                            status_desc,
                            error_insts),
                        ),  # noqa: E123
                    ),  # noqa: E123
                msgid, IMPLEMENTED_PROTOCOL_VERSION),
            IMPLEMENTED_CIM_VERSION, IMPLEMENTED_DTD_VERSION)

        resp_body = '<?xml version="1.0" encoding="utf-8" ?>\n' + \
                    resp_xml.toxml()

        if isinstance(resp_body, six.text_type):
            resp_body = resp_body.encode("utf-8")

        http_code = 200
        self.send_response(http_code, http_client.responses.get(http_code, ''))
        self.send_header("Content-Type", "text/html")
        self.send_header("Content-Length", str(len(resp_body)))
        self.send_header("CIMExport", "MethodResponse")
        self.end_headers()
        self.wfile.write(resp_body)
        self.log('%s: HTTP status %s; CIM error response: %s: %s',
                 (self._get_log_prefix(), http_code,
                  _statuscode2name(status_code), status_desc),
                 logging.WARNING)
Send a CIM-XML response message back to the WBEM server that
        indicates error.