Both the run and the prune subcommand contain code for picking a
suitable snapshot to remove, with slightly different semantics.
This is a preparatory patch for eliminating the differences between
the two implementations. It introduces a new helper which can be
shared. After this patch, only the run subcommand uses the helper. A
subsequent patch will convert the second caller, com_prune().