you should use

```
variables = factor.free_symbols
if len(variables) == 1:
    variable = variables.pop()
    if x == variable:
        factor = ...
```