def getDigestResponse(self, challenge, ncount):
        """
        Calculate the response for the given challenge
        """
        nonce = challenge.get('nonce')
        algo = challenge.get('algorithm').lower()
        qop = challenge.get('qop')

        ha1 = calcHA1(
            algo, self.username, self.realm, self.password, nonce, self.cnonce)
        ha2 = calcHA2(algo, b"GET", self.uri, qop, None)
        expected = calcResponse(
            ha1, ha2, algo, nonce, ncount, self.cnonce, qop)
        return expected

        Calculate the response for the given challenge
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/cred/test/test_digestauth.py