rewrite pop_except_from