':param attributes_a:    A dict of blocks to their attributes
:param attributes_b:    A dict of blocks to their attributes
The following parameters are optional.
:param filter_set_a:    A set to limit attributes_a to the blocks in this set.
:param filter_set_b:    A set to limit attributes_b to the blocks in this set.
:param delta:           An offset to add to each vector in attributes_a.
:returns:               A list of tuples of matching objects.'

def _get_block_matches(self, attributes_a, attributes_b, filter_set_a=None, filter_set_b=None, delta=(0, 0, 0), tiebreak_with_block_similarity=False):

    if (filter_set_a is None):
        filtered_attributes_a = {k: v for (k, v) in attributes_a.items()}
    else:
        filtered_attributes_a = {k: v for (k, v) in attributes_a.items() if (k in filter_set_a)}
    if (filter_set_b is None):
        filtered_attributes_b = {k: v for (k, v) in attributes_b.items()}
    else:
        filtered_attributes_b = {k: v for (k, v) in attributes_b.items() if (k in filter_set_b)}
    for k in filtered_attributes_a:
        filtered_attributes_a[k] = tuple(((i + j) for (i, j) in zip(filtered_attributes_a[k], delta)))
    for k in filtered_attributes_b:
        filtered_attributes_b[k] = tuple(((i + j) for (i, j) in zip(filtered_attributes_b[k], delta)))
    closest_a = _get_closest_matches(filtered_attributes_a, filtered_attributes_b)
    closest_b = _get_closest_matches(filtered_attributes_b, filtered_attributes_a)
    if tiebreak_with_block_similarity:
        for a in closest_a:
            if (len(closest_a[a]) > 1):
                best_similarity = 0
                best = []
                for x in closest_a[a]:
                    similarity = self.block_similarity(a, x)
                    if (similarity > best_similarity):
                        best_similarity = similarity
                        best = [x]
                    elif (similarity == best_similarity):
                        best.append(x)
                closest_a[a] = best
        for b in closest_b:
            if (len(closest_b[b]) > 1):
                best_similarity = 0
                best = []
                for x in closest_b[b]:
                    similarity = self.block_similarity(x, b)
                    if (similarity > best_similarity):
                        best_similarity = similarity
                        best = [x]
                    elif (similarity == best_similarity):
                        best.append(x)
                closest_b[b] = best
    matches = []
    for a in closest_a:
        if (len(closest_a[a]) == 1):
            match = closest_a[a][0]
            if ((len(closest_b[match]) == 1) and (closest_b[match][0] == a)):
                matches.append((a, match))
    return matches
