<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _url_val(val, key, obj, **kwargs):
 """Function applied by `HyperlinksField` to get the correct value in the schema. """

    if isinstance(val, URLFor):
        return val.serialize(key, obj, **kwargs)
    else:
        return val