Given a list of records within a duplicate cluster, constructs a
    canonical representation of the cluster by finding canonical
    values for each field

def getCanonicalRep(record_cluster):
    """
    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[key]:
                key_values.append(record[key])
        if key_values:
            canonical_rep[key] = getCentroid(key_values, comparator)
        else:
            canonical_rep[key] = ''

    return canonical_rep