code: def _get_rerun_log_msg(res):
      "Prepare log message for a rerun to summarize an action about to happen"
      msg = ""
      rerun_action = res.get("rerun_action")
      if rerun_action:
          msg += rerun_action
      if res.get("commit"):
          msg += " commit %s;" % res.get("commit")[:7]
      rerun_run_message = res.get("run_message")
      if rerun_run_message:
          if len(rerun_run_message) > 20:
              rerun_run_message = rerun_run_message[:17] + "..."
          msg += " (%s)" % rerun_run_message
      rerun_message = res.get("message")
      if rerun_message:
          msg += " " + rerun_message[0] % rerun_message[1:]
      msg = msg.lstrip()
      return msg
  
imports: import json
  import logging
  import os.path
  import re
  import sys
  from copy import copy
  from functools import partial
  from itertools import dropwhile
  from datalad.consts import PRE_INIT_COMMIT_SHA
  from datalad.core.local.run import _format_cmd_shorty, assume_ready_opt, format_command, run_command
  from datalad.distribution.dataset import EnsureDataset, datasetmethod, require_dataset
  from datalad.interface.base import Interface, build_doc, eval_results
  from datalad.interface.results import get_status_dict
  from datalad.interface.common_opts import jobs_opt
  from datalad.support.constraints import EnsureNone, EnsureStr
  from datalad.support.exceptions import CapturedException
  from datalad.support.json_py import load_stream
  from datalad.support.param import Parameter
label_desc: Use image node_id 5 for calling a global function with example usage: _get_rerun_log_msg(res) and returns: msg