code: def get_run_info(dset, message):
      """Extract run information from `message`
  
      Parameters
      ----------
      message : str
          A commit message.
  
      Returns
      -------
      A tuple with the command's message and a dict with run information. Both
      these values are None if `message` doesn't have a run command.
  
      Raises
      ------
      A ValueError if the information in `message` is invalid.
      """
      cmdrun_regex = (
          r"\[DATALAD RUNCMD\] (.*)=== Do not change lines below "
          r"===\n(.*)\n\^\^\^ Do not change lines above \^\^\^"
      )
      runinfo = re.match(
          cmdrun_regex, message, re.MULTILINE | re.DOTALL
      )
      if not runinfo:
          return None, None
  
      rec_msg, runinfo = runinfo.groups()
  
      try:
          runinfo = json.loads(runinfo)
      except Exception as e:
          raise ValueError(
              "cannot rerun command, command specification is not valid JSON"
          ) from e
      if not isinstance(runinfo, (list, dict)):
          # this is a run record ID -> load the beast
          record_dir = dset.config.get(
              "datalad.run.record-directory",
              default=op.join(".datalad", "runinfo"),
          )
          record_path = op.join(dset.path, record_dir, runinfo)
          if not op.lexists(record_path):
              raise ValueError(
                  "Run record sidecar file not found: {}".format(
                      record_path
                  )
              )
          # TODO `get` the file
          recs = load_stream(record_path, compressed=True)
          # TODO check if there is a record
          runinfo = next(recs)
      if "cmd" not in runinfo:
          raise ValueError(
              "Looks like a run commit but does not have a command"
          )
      return rec_msg.rstrip(), runinfo
  
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 8 for calling a global function with example usage: get_run_info(dset, message) and returns: rec_msg,  runinfo, None,  None