def METHOD_NAME(self, queryset):
    user_group_id = self.get_query_param('user_group_id')
    user_group_name = self.get_query_param('user_group')
    if user_group_id:
        group = get_object_or_none(UserGroup, pk=user_group_id)
    elif user_group_name:
        group = get_object_or_none(UserGroup, name=user_group_name)
    else:
        return queryset
    if not group:
        return queryset.none()
    queryset = queryset.filter(user_groups=group)
    return queryset