code: def truncate_row_item(
      row_item: RowItem,
      min_cell_bytes: int,
      columns_to_keep_untruncated: list[str],
  ) -> RowItem:
      row = {}
      for column_name, cell in row_item["row"].items():
          # for now: all the cells above min_cell_bytes are truncated to min_cell_bytes
          # it's done by replacing the cell (which can have any type) by a string with
          # its JSON serialization, and then truncating it to min_cell_bytes
          cell_json = orjson_dumps(cell)
          if (
              len(cell_json) <= min_cell_bytes
              or column_name in columns_to_keep_untruncated
          ):
              row[column_name] = cell
          else:
              cell_json_str = cell_json.decode("utf8", "ignore")
              row_item["truncated_cells"].append(column_name)
              row[column_name] = utf8_byte_truncate(
                  text=cell_json_str, max_bytes=min_cell_bytes
              )
      row_item["row"] = row
      # row_idx = row_item["row_idx"]
      # logging.debug(f"the size of the rows is now ({rows_bytes}) after truncating row idx={row_idx}")
      return row_item
  
imports: import functools
  import itertools
  import logging
  import sys
  import time
  import traceback
  import warnings
  from collections.abc import Callable, Sequence
  from fnmatch import fnmatch
  from typing import Any, Optional, TypeVar, Union, cast
  from urllib.parse import quote
  import PIL
  import requests
  from datasets import Dataset, DatasetInfo, DownloadConfig, IterableDataset, load_dataset
  from datasets.utils.file_utils import get_authentication_headers_for_url
  from fsspec.implementations.http import HTTPFileSystem
  from huggingface_hub.hf_api import HfApi
  from huggingface_hub.utils._errors import RepositoryNotFoundError
  from libcommon.constants import EXTERNAL_DATASET_SCRIPT_PATTERN
  from libcommon.exceptions import ConfigNotFoundError, DatasetNotFoundError, DatasetWithScriptNotSupportedError, NormalRowsError, PreviousStepFormatError, SplitNotFoundError, StreamingRowsError
  from libcommon.simple_cache import get_previous_step_or_raise
  from libcommon.utils import Row, RowItem, orjson_dumps
  from pyarrow.parquet import ParquetFile
  from worker.dtos import RowsContent
label_desc: Use image node_id 4 for calling a global function with example usage: truncate_row_item(row_item, min_cell_bytes, columns_to_keep_untruncated) and returns: row_item