This can definitely be made more pythonic, if not outright removed, e.g.

if any(token.upper() in s for s.upper() in blacklisted_tokens):