code: def _handle_read_os_error(
      error: OSError, paths: Union[str, List[str]]
  ) -> str:
      # NOTE: this is not comprehensive yet, and should be extended as more errors arise.
      # NOTE: The latter patterns are raised in Arrow 10+, while the former is raised in
      # Arrow < 10.
      aws_error_pattern = (
          r"^(?:(.*)AWS Error \[code \d+\]: No response body\.(.*))|"
          r"(?:(.*)AWS Error UNKNOWN \(HTTP status 400\) during HeadObject operation: "
          r"No response body\.(.*))|"
          r"(?:(.*)AWS Error ACCESS_DENIED during HeadObject operation: No response "
          r"body\.(.*))$"
      )
      if re.match(aws_error_pattern, str(error)):
          # Specially handle AWS error when reading files, to give a clearer error
          # message to avoid confusing users. The real issue is most likely that the AWS
          # S3 file credentials have not been properly configured yet.
          if isinstance(paths, str):
              # Quote to highlight single file path in error message for better
              # readability. List of file paths will be shown up as ['foo', 'boo'],
              # so only quote single file path here.
              paths = f'"{paths}"'
          raise OSError(
              (
                  f"Failing to read AWS S3 file(s): {paths}. "
                  "Please check that file exists and has properly configured access. "
                  "You can also run AWS CLI command to get more detailed error message "
                  "(e.g., aws s3 ls <file-name>). "
                  "See https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/index.html "  # noqa
                  "and https://docs.ray.io/en/latest/data/creating-datasets.html#reading-from-remote-storage "  # noqa
                  "for more information."
              )
          )
      else:
          raise error
  
imports: import itertools
  import logging
  import os
  import pathlib
  import re
  from typing import TYPE_CHECKING, Any, Callable, Iterator, List, Optional, Tuple, TypeVar, Union
  import numpy
  from ray.data._internal.progress_bar import ProgressBar
  from ray.data._internal.remote_fn import cached_remote_fn
  from ray.data.block import BlockMetadata
  from ray.data.datasource.partitioning import Partitioning
  from ray.util.annotations import DeveloperAPI
label_desc: Use image node_id 1 for calling a global function with example usage: _handle_read_os_error(error, paths) without return types