def _check_and_update_kwargs(version: str, record: TextClassificationRecord, sort_by: SortBy, kwargs: Dict):
    """Helper function to check and update the kwargs passed on to cleanlab's `get_noise_indices`.

    Args:
        version: version of cleanlab
        record: One of the records passed in the `find_label_error` function.
        sort_by: The sorting policy.
        kwargs: The passed on kwargs.

    Raises:
        ValueError: If not supported kwargs ('sorted_index_method') are passed on.
    """
    if "multi_label" in kwargs:
        warnings.warn(
            "You provided the kwarg 'multi_label', but it is determined automatically. "
            f"We will set it to '{record.multi_label}'."
        )
    kwargs["multi_label"] = record.multi_label

    if parse_version(version) < parse_version("2.0"):
        if "sorted_index_method" in kwargs:
            raise ValueError("The 'sorted_index_method' kwarg is not supported, please use 'sort_by' instead.")
        kwargs["sorted_index_method"] = "normalized_margin"
        if sort_by is SortBy.PREDICTION:
            kwargs["sorted_index_method"] = "prob_given_label"
        elif sort_by is SortBy.NONE:
            kwargs["sorted_index_method"] = None
    else:
        if "return_indices_ranked_by" in kwargs:
            raise ValueError("The 'return_indices_ranked_by' kwarg is not supported, please use 'sort_by' instead.")
        kwargs["return_indices_ranked_by"] = "normalized_margin"
        if sort_by is SortBy.PREDICTION:
            kwargs["return_indices_ranked_by"] = "self_confidence"
        elif sort_by is SortBy.NONE:
            kwargs["return_indices_ranked_by"] = None
        # TODO: Remove this once https://github.com/cleanlab/cleanlab/issues/243 is solved
        elif kwargs["multi_label"]:
            warnings.warn(
                "With cleanlab v2 and multi-label records there is an issue sorting records by 'likelihood' "
                "(https://github.com/cleanlab/cleanlab/issues/243). We will sort by 'prediction' instead."
            )
            kwargs["return_indices_ranked_by"] = "self_confidence"
Helper function to check and update the kwargs passed on to cleanlab's `get_noise_indices`.

    Args:
        version: version of cleanlab
        record: One of the records passed in the `find_label_error` function.
        sort_by: The sorting policy.
        kwargs: The passed on kwargs.

    Raises:
        ValueError: If not supported kwargs ('sorted_index_method') are passed on.
    
argilla-v1/src/argilla_v1/labeling/text_classification/label_errors.py