[python] try_inner_function

Check the non-local variable used by a nested function, make sure any changes
to the variable is reflected in the nested function