8 How to find function name and its arguments in a proc?

Suppose one passes \(y(x)\) to a function, and the function wants to find the name of this function and its argument. Here is an example

def process(the_function): 
    print("the function argument is ", the_function.args[0]) 
    print("the function name itself is ", the_function.name) 
import sympy 
x   = sympy.symbols('x') 
y   = sympy.Function('y') 
process(y(x))
 

This prints

the function argument is  x 
the function name itself is  y