nodes: 0, module; 1, function_definition; 2, function_name:_validate_field; 3, parameters; 4, block; 5, identifier:param; 6, identifier:fields; 7, expression_statement; 8, if_statement; 9, comment:""" Ensure the sortable field exists on the model """; 10, comparison_operator:param.field not in fields; 11, block; 12, attribute; 13, identifier:fields; 14, raise_statement; 15, identifier:param; 16, identifier:field; 17, call; 18, identifier:InvalidQueryParams; 19, argument_list; 20, dictionary_splat; 21, dictionary; 22, pair; 23, pair; 24, pair; 25, string; 26, binary_operator:'The sort query param value of "%s" is '
                        'invalid. That field does not exist on the '
                        'resource being requested.' % param.raw_field; 27, string; 28, identifier:LINK; 29, string; 30, identifier:PARAM; 31, string_content:detail; 32, concatenated_string; 33, attribute; 34, string_content:links; 35, string_content:parameter; 36, string:'The sort query param value of "%s" is '; 37, string; 38, string; 39, identifier:param; 40, identifier:raw_field; 41, string_content:invalid. That field does not exist on the; 42, string_content:resource being requested.
code: 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,
          })