def METHOD_NAME(self, queryset, name: str, value: bool):
    query = ~Q(_value=None) & Q(token_address=None)
    if value:
        return queryset.filter(query)
    else:
        return queryset.exclude(query)