code: def getCanonicalRep(
      record_cluster: Sequence[RecordDict],
  ) -> Mapping[str, str]:
      """
      Given a list of records within a duplicate cluster, constructs a
      canonical representation of the cluster by finding canonical
      values for each field
  
      """
      canonical_rep = {}
  
      keys = record_cluster[0].keys()
  
      for key in keys:
          key_values = []
          for record in record_cluster:
              # assume non-empty values always better than empty value
              # for canonical record
              if record.get(key):
                  key_values.append(record[key])
          if key_values:
              canonical_rep[key] = getCentroid(key_values, affine)
          else:
              canonical_rep[key] = ""
  
      return canonical_rep
  
file_path: dedupe/dedupe/canonical.py
imports: from typing import Mapping, Sequence
  import numpy
  import numpy.typing
  from affinegap import normalizedAffineGapDistance
  from dedupe._typing import Comparator, RecordDict
label_desc: Use image node_id 3 for calling a global function with example usage: getCanonicalRep(record_cluster) and returns: canonical_rep