def single_sort_by(queryset, params):
    """
    Orders and returns the queryset using the GET parameters of a request
    The function takes care of checking if the "sort_by" key exists in the dict
    :param queryset queryset: A queryset object from a django model
    :param dict params: Dict containing the request params
    :return: The sorted and updated queryset
    :rtype: queryset
    """
    sort_by = params.get("sort_by", None)
    if sort_by:
        ascending = params.get("ascending", False)
        if ascending != "true":
            sort_by = "-" + sort_by
        queryset = queryset.order_by(sort_by)
    return queryset