@classmethod
    def validate_hmac(cls, params):
        if 'hmac' not in params:
            return False

        hmac_calculated = cls.calculate_hmac(params).encode('utf-8')
        hmac_to_verify = params['hmac'].encode('utf-8')

        # Try to use compare_digest() to reduce vulnerability to timing attacks.
        # If it's not available, just fall back to regular string comparison.
        try:
            return hmac.compare_digest(hmac_calculated, hmac_to_verify)
        except __HOLE__:
            return hmac_calculated == hmac_to_verify
dataset/ETHPy150Open Shopify/shopify_python_api/shopify/session.py/Session.validate_hmac