Hi,
Since functions run on the Puppet Master side, the simplest solution is to cache the value if its "freshness" is not mandatory i.e. does not change, lets say every 5 minutes? Or, even it will be fine every 24 hours, etc ...
Consider this snippet: https://gist.github.com/3680388
Let me know if you have troubles adapting this for your function, I am always keen to help :)