utility to bind a function to a scope