workaround: can't put natural_sort_key in main namespace
main: added select_neighbors_by_layer()
rst: added get_segment_spans_from_rst_relation()