<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _validate_field(param, fields):
 """ Ensure the sortable field exists on the model """


    if param.field not in fields:
        raise InvalidQueryParams(**{
            'detail': 'The sort query param value of "%s" is '
                      'invalid. That field does not exist on the '
                      'resource being requested.' % param.raw_field,
            'links': LINK,
            'parameter': PARAM,
        })