def METHOD_NAME(
    self,
    user: AbstractUser,
    filter_states: Optional[List[str]],
    filter_ids: Optional[List[int]],
) -> QuerySet:
    """
    Returns all jobs belonging to the specified user.
    :param user: The user we want the jobs for.
    :param filter_states: A list of states that the jobs should have, or not
        have if prefixed with a !.
    :param filter_ids: A list of specific job ids to return.
    :return: A QuerySet with the filtered jobs for the user.
    """
    def get_job_states_filter(states):
        states_q = Q()
        for state in states:
            if state.startswith("!"):
                states_q &= ~Q(state=state[1:])
            else:
                states_q |= Q(state=state)
        return states_q
    queryset = Job.objects.filter(user=user).order_by("-updated_on")
    if filter_states:
        queryset = queryset.filter(get_job_states_filter(filter_states))
    if filter_ids:
        queryset = queryset.filter(id__in=filter_ids)
    return queryset.select_related("content_type")