I changed this to
if expr.arg == symbol:
I'm can't say if it is always true, but the tests pass.