code: def _read_image(filepath, image_size=None):
      """Read an image and optionally resize it (size must be: height, width)."""
      cv2 = tfds.core.lazy_imports.cv2
      with tf.io.gfile.GFile(filepath, "rb") as f:
          image = cv2.imdecode(
              np.frombuffer(f.read(), dtype=np.uint8),
              flags=cv2.IMREAD_GRAYSCALE,
          )
          if image_size:
              # Note: cv2.resize actually expects (width, size).
              image = cv2.resize(image, (image_size[1], image_size[0]))
              assert image.shape == image_size
          return image
  
imports: import csv
  import os
  import re
  from absl import logging
  import numpy
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  import tensorflow_datasets.public_api
label_desc: Use image node_id 5 for calling a global function with example usage: _read_image(filepath, image_size) and returns: image