code: def compute_class_label_statistics(
      df: pl.dataframe.frame.DataFrame,
      column_name: str,
      class_label_feature: ClassLabel,
      n_samples: int,
  ) -> CategoricalStatisticsItem:
      nan_count = df[column_name].null_count()
      nan_proportion = (
          np.round(nan_count / n_samples, DECIMALS).item()
          if nan_count != 0
          else 0.0
      )
  
      ids2counts: dict[int, int] = dict(df[column_name].value_counts().rows())  # type: ignore
      no_label_count = ids2counts.pop(NO_LABEL_VALUE, 0)
      no_label_proportion = (
          np.round(no_label_count / n_samples, DECIMALS).item()
          if no_label_count != 0
          else 0.0
      )
  
      num_classes = len(class_label_feature.names)
      labels2counts: dict[str, int] = {
          class_label_feature.int2str(cat_id): ids2counts.get(cat_id, 0)
          for cat_id in range(num_classes)
      }
      n_unique = df[column_name].n_unique()
      logging.debug(
          f"{nan_count=} {nan_proportion=} {no_label_count=} {no_label_proportion=} "
          f"{n_unique=} {labels2counts=}"
      )
  
      if n_unique > num_classes + int(no_label_count > 0) + int(
          nan_count > 0
      ):
          raise StatisticsComputationError(
              f"Got unexpected result for ClassLabel {column_name=}: "
              f" number of unique values is greater than provided by feature metadata. "
              f" {n_unique=}, {class_label_feature=}, {no_label_count=}, {nan_count=}. "
          )
  
      return CategoricalStatisticsItem(
          nan_count=nan_count,
          nan_proportion=nan_proportion,
          no_label_count=no_label_count,
          no_label_proportion=no_label_proportion,
          n_unique=num_classes,
          frequencies=labels2counts,
      )
  
imports: import enum
  import logging
  import os
  from pathlib import Path
  from typing import Any, Optional, TypedDict, Union
  import numpy
  import polars
  from datasets import ClassLabel, Features
  from huggingface_hub import hf_hub_download
  from libcommon.exceptions import CacheDirectoryNotInitializedError, NoSupportedFeaturesError, ParquetResponseEmptyError, PreviousStepFormatError, SplitWithTooBigParquetError, StatisticsComputationError
  from libcommon.simple_cache import get_previous_step_or_raise
  from libcommon.storage import StrPath
  from libcommon.utils import JobInfo
  from requests.exceptions import ReadTimeout
  from tqdm import tqdm
  from worker.config import AppConfig, DescriptiveStatisticsConfig
  from worker.dtos import CompleteJobResult
  from worker.job_runners.split.split_job_runner import SplitJobRunnerWithCache
  from worker.utils import HF_HUB_HTTP_ERROR_RETRY_SLEEPS, retry
label_desc: Use image node_id 4 for calling a global function with example usage: compute_class_label_statistics(df, column_name, class_label_feature, n_samples) and returns: CategoricalStatisticsItem