def get_clusters(preds):
    """ Convert {antecedent_id: mention_id} pairs into {mention_id: assigned_cluster_id} pairs. """
    cluster_assignments = {}

    for id_cluster, cluster_starter in enumerate(preds.get(None, [])):
        stack = [cluster_starter]
        curr_cluster = []
        while len(stack) > 0:
            cur = stack.pop()
            curr_cluster.append(cur)
            cluster_assignments[cur] = id_cluster
            mentions = preds.get(cur)
            if mentions is not None:
                stack.extend(mentions)

    return cluster_assignments