code: def mock_cord_dataset(tmpdir_factory, mock_image_stream):
      root = tmpdir_factory.mktemp("datasets")
      cord_root = root.mkdir("cord_train")
      image_folder = cord_root.mkdir("image")
      annotations_folder = cord_root.mkdir("json")
      labels = {
          "dontcare": [],
          "valid_line": [
              {
                  "words": [
                      {
                          "quad": {
                              "x2": 270,
                              "y3": 390,
                              "x3": 270,
                              "y4": 390,
                              "x1": 256,
                              "y1": 374,
                              "x4": 256,
                              "y2": 374,
                          },
                          "is_key": 0,
                          "row_id": 2179893,
                          "text": "I",
                      }
                  ],
                  "category": "menu.cnt",
                  "group_id": 3,
              },
              {
                  "words": [
                      {
                          "quad": {
                              "x2": 270,
                              "y3": 418,
                              "x3": 270,
                              "y4": 418,
                              "x1": 258,
                              "y1": 402,
                              "x4": 258,
                              "y2": 402,
                          },
                          "is_key": 0,
                          "row_id": 2179894,
                          "text": "am",
                      }
                  ],
                  "category": "menu.cnt",
                  "group_id": 4,
              },
              {
                  "words": [
                      {
                          "quad": {
                              "x2": 272,
                              "y3": 444,
                              "x3": 272,
                              "y4": 444,
                              "x1": 258,
                              "y1": 428,
                              "x4": 258,
                              "y2": 428,
                          },
                          "is_key": 0,
                          "row_id": 2179895,
                          "text": "Luke",
                      }
                  ],
                  "category": "menu.cnt",
                  "group_id": 5,
              },
          ],
      }
  
      file = BytesIO(mock_image_stream)
      for i in range(3):
          fn_i = image_folder.join(f"receipt_{i}.png")
          with open(fn_i, "wb") as f:
              f.write(file.getbuffer())
          fn_l = annotations_folder.join(f"receipt_{i}.json")
          with open(fn_l, "w") as f:
              json.dump(labels, f)
  
      # Packing data into an archive to simulate the real data set and bypass archive extraction
      archive_path = root.join("cord_train.zip")
      shutil.make_archive(
          root.join("cord_train"), "zip", str(cord_root)
      )
      return str(archive_path)
  
imports: import json
  import shutil
  import tempfile
  from io import BytesIO
  import cv2
  import hdf5storage
  import numpy
  import pytest
  import requests
  import scipy.io
  from PIL import Image
  from doctr.datasets.generator.base import synthesize_text_img
  from doctr.io import reader
  from doctr.utils import geometry
label_desc: Use image node_id 18 for calling a global function with example usage: mock_cord_dataset(tmpdir_factory, mock_image_stream) and returns: str