code: def test_duplicate_keys(writer_batch_size):
      output = pa.BufferOutputStream()
      with ArrowWriter(
          stream=output,
          writer_batch_size=writer_batch_size,
          hash_salt="split_name",
          check_duplicates=True,
      ) as writer:
          with pytest.raises(DuplicatedKeysError):
              writer.write({"col_1": "foo", "col_2": 1}, key=10)
              writer.write({"col_1": "bar", "col_2": 2}, key=10)
              num_examples, num_bytes = writer.finalize()
  
imports: import copy
  import os
  import tempfile
  from unittest import TestCase
  from unittest.mock import patch
  import numpy
  import pyarrow
  import pyarrow.parquet
  import pytest
  from datasets.arrow_writer import ArrowWriter, OptimizedTypedSequence, ParquetWriter, TypedSequence
  from datasets.features import Array2D, ClassLabel, Features, Image, Value
  from datasets.features.features import Array2DExtensionType, cast_to_python_objects
  from datasets.keyhash import DuplicatedKeysError, InvalidKeyError
  from .utils import require_pil
label_desc: Use image node_id 5 for calling a global function with example usage: test_duplicate_keys(writer_batch_size) without return types