Extract function mark_weighted_percentiles from statshelpers.