### how to use certain maxima functions (e.g. ratsubst)?

I cannot figure out how to use maxima functions like ratsubst within sage.

For example:
X = maxima('x^2')
Now I'd like to substitute x with k. In Maxima, this is done via:
X: x^2;
ratsubst(k, x, X);

How do I call ratsubst from Sage? If I use X.ratsubst('k', 'x') then it simply prints out 'x'...