def _make_response(self, charset, realms, nonce):
<EOL>params = []<EOL>realm = self._get_realm(realms, charset)<EOL>if isinstance(realm, Failure):<EOL><INDENT>return realm<EOL><DEDENT>elif realm:<EOL><INDENT>realm = _quote(realm)<EOL>params.append(b'<STR_LIT>' + realm + b'<STR_LIT:">')<EOL><DEDENT>try:<EOL><INDENT>username = self.username.encode(charset)<EOL><DEDENT>except UnicodeError:<EOL><INDENT>logger.debug("<STR_LIT>".format(charset))<EOL>return Failure("<STR_LIT>")<EOL><DEDENT>username = _quote(username)<EOL>params.append(b'<STR_LIT>' + username + b'<STR_LIT:">')<EOL>cnonce = self.in_properties.get(<EOL>"<STR_LIT>", default_nonce_factory)()<EOL>cnonce = _quote(cnonce)<EOL>params.append(b'<STR_LIT>' + cnonce + b'<STR_LIT:">')<EOL>params.append(b'<STR_LIT>' + nonce + b'<STR_LIT:">')<EOL>self.nonce_count += <NUM_LIT:1><EOL>nonce_count = "<STR_LIT>".format(self.nonce_count).encode("<STR_LIT>")<EOL>params.append(b'<STR_LIT>' + nonce_count)<EOL>params.append(b'<STR_LIT>')<EOL>serv_type = self.in_properties["<STR_LIT>"]<EOL>serv_type = serv_type.encode("<STR_LIT>")<EOL>serv_name = self.in_properties["<STR_LIT>"]<EOL>host = self.in_properties.get("<STR_LIT>", serv_name)<EOL>serv_name = serv_name.encode("<STR_LIT>")<EOL>host = host.encode("<STR_LIT>")<EOL>if serv_name and serv_name != host:<EOL><INDENT>digest_uri = b"<STR_LIT:/>".join((serv_type, host, serv_name))<EOL><DEDENT>else:<EOL><INDENT>digest_uri = b"<STR_LIT:/>".join((serv_type, host))<EOL><DEDENT>digest_uri = _quote(digest_uri)<EOL>params.append(b'<STR_LIT>' + digest_uri + b'<STR_LIT:">')<EOL>if self.authzid:<EOL><INDENT>try:<EOL><INDENT>authzid = self.authzid.encode(charset)<EOL><DEDENT>except UnicodeError:<EOL><INDENT>logger.debug("<STR_LIT>".format(charset))<EOL>return Failure("<STR_LIT>")<EOL><DEDENT>authzid = _quote(authzid)<EOL><DEDENT>else:<EOL><INDENT>authzid = b"<STR_LIT>"<EOL><DEDENT>try:<EOL><INDENT>epasswd = self.in_properties["<STR_LIT:password>"].encode(charset)<EOL><DEDENT>except UnicodeError:<EOL><INDENT>logger.debug("<STR_LIT>"<EOL>.format(charset))<EOL>return Failure("<STR_LIT>")<EOL><DEDENT>logger.debug("<STR_LIT>".format(epasswd))<EOL>urp_hash = _make_urp_hash(username, realm, epasswd)<EOL>response = _compute_response(urp_hash, nonce, cnonce, nonce_count,<EOL>authzid, digest_uri)<EOL>self.response_auth = _compute_response_auth(urp_hash, nonce, cnonce,<EOL>nonce_count, authzid, digest_uri)<EOL>params.append(b'<STR_LIT>' + response)<EOL>if authzid:<EOL><INDENT>params.append(b'<STR_LIT>' + authzid + b'<STR_LIT:">')<EOL><DEDENT>return Response(b"<STR_LIT:U+002C>".join(params))<EOL>
Make a response for the first challenge from the server.

        :Parameters:
            - `charset`: charset name from the challenge.
            - `realms`: realms list from the challenge.
            - `nonce`: nonce value from the challenge.
        :Types:
            - `charset`: `bytes`
            - `realms`: `bytes`
            - `nonce`: `bytes`

        :return: the response or a failure indicator.
        :returntype: `sasl.Response` or `sasl.Failure`