code: def _create_record(run_info, sidecar_flag, ds):
      """
      Returns
      -------
      str or None, str or None
        The first value is either the full run record in JSON serialized form,
        or content-based ID hash, if the record was written to a file. In that
        latter case, the second value is the path to the record sidecar file,
        or None otherwise.
      """
      record = json.dumps(
          run_info, indent=1, sort_keys=True, ensure_ascii=False
      )
      if sidecar_flag is None:
          use_sidecar = ds.config.get(
              "datalad.run.record-sidecar", default=False
          )
          use_sidecar = anything2bool(use_sidecar)
      else:
          use_sidecar = sidecar_flag
  
      record_id = None
      record_path = None
      if use_sidecar:
          # record ID is hash of record itself
          from hashlib import md5
  
          record_id = md5(record.encode("utf-8")).hexdigest()  # nosec
          record_dir = ds.config.get(
              "datalad.run.record-directory",
              default=op.join(".datalad", "runinfo"),
          )
          record_path = ds.pathobj / record_dir / record_id
          if not op.lexists(record_path):
              # go for compression, even for minimal records not much difference,
              # despite offset cost
              # wrap in list -- there is just one record
              dump2stream([run_info], record_path, compressed=True)
      return record_id or record, record_path
  
imports: import json
  import logging
  import os
  import os.path
  import warnings
  from argparse import REMAINDER
  from pathlib import Path
  from tempfile import mkdtemp
  import datalad
  import datalad.support.ansi_colors
  from datalad.config import anything2bool
  from datalad.core.local.save import Save
  from datalad.core.local.status import Status
  from datalad.distribution.dataset import Dataset, EnsureDataset, datasetmethod, require_dataset
  from datalad.distribution.get import Get
  from datalad.distribution.install import Install
  from datalad.interface.base import Interface, build_doc, eval_results
  from datalad.interface.common_opts import jobs_opt, save_message_opt
  from datalad.interface.results import get_status_dict
  from datalad.interface.utils import generic_result_renderer
  from datalad.local.unlock import Unlock
  from datalad.support.constraints import EnsureBool, EnsureChoice, EnsureNone
  from datalad.support.exceptions import CapturedException, CommandError
  from datalad.support.globbedpaths import GlobbedPaths
  from datalad.support.json_py import dump2stream
  from datalad.support.param import Parameter
  from datalad.ui import ui
  from datalad.utils import SequenceFormatter, chpwd, ensure_list, ensure_unicode, get_dataset_root, getpwd, join_cmdline, quote_cmdlinearg
label_desc: Use image node_id 15 for calling a global function with example usage: _create_record(run_info, sidecar_flag, ds) and returns: unknown,  record_path