### Get variable of polynomial ring

I have a univariate polynomial ring and a polynomial in this ring, e.g.

```
R.<x> = PolynomialRing(ZZ);
p = 3*x^2 + 7*x - 5;
```

My question is: If I call a function with such a polynomial how can I figure out what the original variable was?
For instance, say I have the following:

```
def f(q) :
return q*x;
print f(p)
```

Of course that is a rather stupid example but I hope the idea is clear. How can I swap x with something more general like *f.parent().variable()* or is there a better way to do such things?

Thank you very much for your help!