def get_condition_common_targets(condition, definitions_index, symbol_resolver
    ):
    """Return the targets that are common to all clauses of the condition.

    Common targets include:
       * And condition - any vertex that is part of the condition can
                         be a target
       * Not condition - no vertex that is part of the condition can
                         be a target
       * Or condition - vertices that appear in any "positive" part (i.e. one
                        that doesn't have a 'not' in front of it) of the
                        Or condition

    A complete description of all options can be found in Vitrage
    'external-actions' spec.

    The condition format:
        [[and_var1, and_var2, ...], or_list_2, ...]

    :return: A set of vertices that are common to all clauses of the condition
    """
    clauses_targets = []
    for clause in condition:
        clause_targets = set()
        for term in clause:
            if term.positive:
                symbol = definitions_index.get(term.symbol_name)
                if symbol and symbol_resolver.is_relationship(symbol):
                    clause_targets.add(symbol_resolver.
                        get_relationship_source_id(symbol))
                    clause_targets.add(symbol_resolver.
                        get_relationship_target_id(symbol))
                elif symbol:
                    clause_targets.add(symbol_resolver.get_entity_id(symbol))
        clauses_targets.append(clause_targets)
    return set.intersection(*clauses_targets)
