Port CTokenizer's verify_safe method to Python to solve a failing test.