'Parallel swap assignments like \'a,b = b,a\' are safe.'

def visit_ParallelAssignmentNode(self, node):

    (left_names, right_names) = ([], [])
    (left_indices, right_indices) = ([], [])
    temps = []
    for stat in node.stats:
        if isinstance(stat, Nodes.SingleAssignmentNode):
            if (not self._extract_operand(stat.lhs, left_names, left_indices, temps)):
                return node
            if (not self._extract_operand(stat.rhs, right_names, right_indices, temps)):
                return node
        elif isinstance(stat, Nodes.CascadedAssignmentNode):
            return node
        else:
            return node
    if (left_names or right_names):
        lnames = [path for (path, n) in left_names]
        rnames = [path for (path, n) in right_names]
        if (set(lnames) != set(rnames)):
            return node
        if (len(set(lnames)) != len(right_names)):
            return node
    if (left_indices or right_indices):
        lindices = []
        for lhs_node in left_indices:
            index_id = self._extract_index_id(lhs_node)
            if (not index_id):
                return node
            lindices.append(index_id)
        rindices = []
        for rhs_node in right_indices:
            index_id = self._extract_index_id(rhs_node)
            if (not index_id):
                return node
            rindices.append(index_id)
        if (set(lindices) != set(rindices)):
            return node
        if (len(set(lindices)) != len(right_indices)):
            return node
        return node
    temp_args = [t.arg for t in temps]
    for temp in temps:
        temp.use_managed_ref = False
    for (_, name_node) in (left_names + right_names):
        if (name_node not in temp_args):
            name_node.use_managed_ref = False
    for index_node in (left_indices + right_indices):
        index_node.use_managed_ref = False
    return node
