code: def _validate_multilabel(
      *,
      dataset: "TextData",
      predictions: Any = None,
      probabilities: Any = None,
      n_of_classes: Optional[int] = None,
  ) -> Tuple[
      Optional[np.ndarray],  # predictions
      Optional[np.ndarray],  # probabilities
  ]:
      if predictions is not None:
          format_error_message = (
              "Check requires multi-label classification predictions for "
              f'the "{dataset.name}" dataset to be of a type sequence[sequence[int]] '
              "that can be cast to a 2D numpy array of a shape (n_samples, n_classes)"
          )
          if not is_sequence_not_str(predictions):
              raise ValidationError(format_error_message)
          if len(predictions) != dataset.n_samples:
              raise ValidationError(
                  "Check requires multi-label classification predictions "
                  f'for the "{dataset.name}" dataset to have {dataset.n_samples} rows, '
                  "same as dataset"
              )
          try:
              predictions = np.array(predictions).astype(float)
          except ValueError as e:
              raise ValidationError(
                  "Failed to cast multi-label predictions to a numpy array. "
                  f"{format_error_message}"
              ) from e
          else:
              if predictions.ndim != 2:
                  raise ValidationError(format_error_message)
              if (
                  n_of_classes is not None
                  and predictions.shape[1] != n_of_classes
              ):
                  raise ValidationError(
                      "Check requires multi-label classification predictions "
                      f'for the "{dataset.name}" dataset to have {n_of_classes} columns, '
                      "same as the number of classes"
                  )
              if not np.array_equal(
                  predictions, predictions.astype(bool)
              ):
                  raise ValidationError(
                      "Check requires multi-label classification predictions "
                      f'for the "{dataset.name}" dataset to be either 0 or 1'
                  )
      if probabilities is not None:
          format_error_message = (
              "Check requires multi-label classification probabilities "
              f'for the "{dataset.name}" to be of a type sequence[sequences[float]] '
              "that can be cast to a 2D numpy array of a shape (n_samples, n_classes). "
              "Each label probability value must lay between 0 and 1"
          )
          if len(probabilities) != dataset.n_samples:
              raise ValidationError(
                  "Check requires multi-label classification probabilities "
                  f'for the "{dataset.name}" dataset to have {dataset.n_samples} rows, '
                  "same as dataset"
              )
          try:
              probabilities = np.array(probabilities, dtype="float")
          except ValueError as e:
              raise ValidationError(
                  "Failed to cast multi-label probabilities to a numpy "
                  f"array. {format_error_message}"
              ) from e
          else:
              if probabilities.ndim != 2:
                  raise ValidationError(format_error_message)
              if (
                  n_of_classes is not None
                  and probabilities.shape[1] != n_of_classes
              ):
                  raise ValidationError(
                      f"Check requires multi-label classification probabilities "
                      f'for the "{dataset.name}" dataset to have {n_of_classes} columns, '
                      "same as the number of classes"
                  )
              if (probabilities > 1).any() or (probabilities < 0).any():
                  # TODO: better message
                  raise ValidationError(format_error_message)
  
      return predictions, probabilities
  
imports: import collections
  from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional, Sequence, Set, Tuple, Type, cast
  import numpy
  import pandas
  from deepchecks.core.errors import DeepchecksValueError, ValidationError
  from deepchecks.nlp.task_type import TaskType, TTextLabel
  from deepchecks.utils.logger import get_logger
  from deepchecks.utils.metrics import is_label_none
  from deepchecks.utils.type_inference import infer_categorical_features, infer_numerical_features
  from deepchecks.utils.validation import is_sequence_not_str
label_desc: Use image node_id 9 for calling a global function with example usage: _validate_multilabel() and returns: predictions,  probabilities