I would recommend not scanning twice for free symbols:

```
free = testxy.free_symbols
if len(free) and free.pop() == t:
    ....
```