code: def pair_gazette_matching(
      scored_pairs: Scores, threshold: float = 0.0, n_matches: int = 1
  ) -> ArrayLinks:
      scored_pairs.sort(order="pairs")
  
      group_key = scored_pairs["pairs"][:, 0]
      change_points = numpy.where(
          numpy.roll(group_key, 1) != group_key
      )[0]
      scored_blocks = numpy.split(scored_pairs, change_points)
  
      for match in gazetteMatching(scored_blocks, threshold, n_matches):
          if match:
              yield from match
  
imports: from __future__ import annotations
  import array
  import itertools
  import logging
  import tempfile
  from collections import defaultdict
  from typing import Generator, Iterable, Sequence, cast
  import numpy
  import numpy.typing
  import scipy.cluster.hierarchy
  from dedupe._typing import ArrayLinks, Clusters, RecordID, Scores, TupleLinks
label_desc: Use image node_id 9 for calling a global function with example usage: pair_gazette_matching(scored_pairs, threshold, n_matches) without return types