sorted_spaces: wrapper function for space_partition.