3967: Move glidein_max_run into its own function
3967: Use dict.setdefault when possible for history_obj