code: def is_document_image_column(
      data: pd.Series,
      col_name: str,
      image_type: Optional[str] = IMAGE_PATH,
      sample_m: Optional[int] = 10,
      text_len_threshold: Optional[int] = 100,
  ) -> bool:
      """
      Identify if a column is a document image column.
  
      Parameters
      ----------
      data
          One column of a multimodal pd.DataFrame for training.
      col_name
          Name of column.
      image_type
          The image type to check. Set to IMAGE_PATH by default.
      sample_m
          Number of sample images used to check if images are documents images.
      text_len_threshold
          If the average text length is longer than text_len_threshold, the images will be considered as document images.
      Returns
      -------
      Whether the column is a document image column.
      """
  
      # TODO: Add support for other types (e.g., pdf) of document.
  
      words_len = []
      if len(data) > sample_m:
          # Sample to speed-up type inference
          data = data.sample(n=sample_m, random_state=0)
      failure_count = 0
      for images in data:
          success = False
          if not isinstance(images, list):
              images = [images]
          for per_image in images:
              try:
                  # convert images to string
                  with PIL.Image.open(per_image) as doc_image:
                      words = pytesseract.image_to_string(doc_image)
                      words_len.append(len(words))
              except Exception as e:
                  words_len.append(0)
                  success = False
                  break
              success = True
          if not success:
              failure_count += 1
  
      if (1 - failure_count / sample_m) >= 0.8:
          logger.debug(
              f"Average length of words of this dataset is {sum(words_len) / len(words_len)}."
          )
          if sum(words_len) / len(words_len) > text_len_threshold:
              return True
          else:
              return False
      else:
          False
  
imports: import collections
  import json
  import logging
  import warnings
  from io import BytesIO
  from typing import Dict, List, Optional, Tuple, Union
  import pandas
  import PIL
  import pytesseract
  from autogluon.core.utils import infer_problem_type
  from ..constants import BINARY, CATEGORICAL, CLASSIFICATION, DOCUMENT_IMAGE, DOCUMENT_PDF, IDENTIFIER, IMAGE, IMAGE_BYTEARRAY, IMAGE_PATH, MULTICLASS, NER, NER_ANNOTATION, NULL, NUMERICAL, OBJECT_DETECTION, OPEN_VOCABULARY_OBJECT_DETECTION, REGRESSION, ROIS, SEMANTIC_SEGMENTATION, SEMANTIC_SEGMENTATION_GT, SEMANTIC_SEGMENTATION_IMG, TEXT, TEXT_NER
  from .utils import is_rois_input
label_desc: Use image node_id 6 for calling a global function with example usage: is_document_image_column(data, col_name, image_type, sample_m, text_len_threshold) and returns: True, False