Using == for secret comparison is vulnerable to timing attacks.
Use hmac.compare_digest() for constant-time string comparison of secrets.