code: def _validate_predictions_label_common_format(
      name, data, task_type: TaskType
  ):
      """Validate that the data is in the required format and returns a non-empty sample in numpy format."""
      name_plural = name + "s"
      if task_type == TaskType.OTHER:
          return None
      try:
          _ = data[0]
          data = sequence_to_numpy(data)
      except (IndexError, KeyError, TypeError) as err:
          raise ValidationError(
              f"The batch {name_plural} must be a non empty iterable."
          ) from err
  
      sample_idx = 0
      while data[sample_idx] is None or (
          isinstance(data[sample_idx], np.ndarray)
          and data[sample_idx].shape[0] == 0
      ):
          sample_idx += 1
          if sample_idx == len(data):
              return None  # No data to validate
  
      if task_type == TaskType.CLASSIFICATION:
          return data[
              sample_idx
          ]  # for classification, the data is a single number no need to validate shape
      try:
          sample_shape = data[sample_idx].shape
      except AttributeError as err:
          raise ValidationError(
              f"{name} for {task_type.value} per image must be a multi dimensional array."
          ) from err
  
      if task_type == TaskType.OBJECT_DETECTION and len(
          sample_shape
      ) not in (1, 2):
          raise ValidationError(
              f"{name} for object detection per image must be a 2D array. Found shape {sample_shape}"
          )
  
      return data[sample_idx]
  
file_path: deepchecks/deepchecks/vision/vision_data/format_validators.py
imports: from numbers import Number
  from typing import Iterable
  import numpy
  from deepchecks.core.errors import ValidationError
  from deepchecks.vision.vision_data import TaskType
  from deepchecks.vision.vision_data.utils import object_to_numpy, sequence_to_numpy
label_desc: Use image node_id 4 for calling a global function with example usage: _validate_predictions_label_common_format(name, data, task_type) and returns: data, None, data, None