def _same_filter(node1, node2, candidate_list):
    """
    Filter out candidates which do not adhere the same target composition
    request.
    """
    for candidate in list(candidate_list.keys()):
        n1_trg = ''
        n2_trg = ''
        for src, trg in candidate_list[candidate]:
            if n1_trg == '' and src == node1:
                n1_trg = trg
            elif n1_trg != '' and src == node2:
                if trg != n1_trg:
                    candidate_list.pop(candidate)
                    break
            if n2_trg == '' and src == node2:
                n2_trg = trg
            elif n2_trg != '' and src == node1:
                if trg != n2_trg:
                    candidate_list.pop(candidate)
                    break
