Allow endpoint passed to url_for to be a function.

Rather than requiring a string allow endpoint passed to url_for to be a function.