def _handle_links(event):
 global tree
 tree = spanning_tree._calc_spanning_tree()

def _handle_links ( event ) : global tree tree = spanning_tree . _calc_spanning_tree ( )
handle discovery link events to update the spanning tree .