I am not sure what you mean by whether the function returns a FEniCS function. It is simply a Python function, such as an interpolation (with Scipy) of random or almost random datapoints. When you call it, it returns a value, a float for example.
Regarding your last comment, I cannot do that because I am precisely unable to apply the BC!