#NEWLINE# def pruneLabels( path ) : #NEWLINE# #INDENT# '\n    Some networks does not support underspecified STPs and VLAN rewrites so we help them out a bit.\n    ' #NEWLINE# for ( idx , link ) in enumerate ( path ) : #NEWLINE# #INDENT# if any ( [ ( n in link . src_stp . network ) for n in NETWORKS ] ) : #NEWLINE# #INDENT# liv = link . src_stp . label . intersect ( lnv . dst_stp . label ) #NEWLINE# lnv = nsa . Label ( liv . type_ , liv . labelValue ( ) ) #NEWLINE# link . src_stp . label = lnv #NEWLINE# link . dst_stp . label = lnv #NEWLINE# if ( idx > 0 ) : #NEWLINE# #INDENT# prev_link = path [ ( idx - 1 ) ] #NEWLINE# prev_link . dst_stp . label = lnv #NEWLINE# #UNINDENT# if ( idx < ( len ( path ) - 1 ) ) : #NEWLINE# #INDENT# next_link = path [ ( idx + 1 ) ] #NEWLINE# next_link . src_stp . label = lnv #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return path