def HA2(credentials, request, algorithm):
if credentials.get("<STR_LIT>") == "<STR_LIT>" or credentials.get('<STR_LIT>') is None:<EOL><INDENT>return H(b"<STR_LIT::>".join([request['<STR_LIT>'].encode('<STR_LIT:utf-8>'), request['<STR_LIT>'].encode('<STR_LIT:utf-8>')]), algorithm)<EOL><DEDENT>elif credentials.get("<STR_LIT>") == "<STR_LIT>":<EOL><INDENT>for k in '<STR_LIT>', '<STR_LIT>', '<STR_LIT:body>':<EOL><INDENT>if k not in request:<EOL><INDENT>raise ValueError("<STR_LIT>" % k)<EOL><DEDENT><DEDENT>A2 = b"<STR_LIT::>".join([request['<STR_LIT>'].encode('<STR_LIT:utf-8>'),<EOL>request['<STR_LIT>'].encode('<STR_LIT:utf-8>'),<EOL>H(request['<STR_LIT:body>'], algorithm).encode('<STR_LIT:utf-8>')])<EOL>return H(A2, algorithm)<EOL><DEDENT>raise ValueError<EOL>
Create HA2 md5 hash

    If the qop directive's value is "auth" or is unspecified, then HA2:
        HA2 = md5(A2) = MD5(method:digestURI)
    If the qop directive's value is "auth-int" , then HA2 is
        HA2 = md5(A2) = MD5(method:digestURI:MD5(entityBody))