code: def _gitcfg_rec_to_keyvalue(rec):
      """Helper for parse_gitconfig_dump()
  
      Parameters
      ----------
      rec: str
        Key/value specification string
  
      Returns
      -------
      str, str
        Parsed key and value. Key and/or value could be None
        if not syntax-compliant (former) or absent (latter).
      """
      kv_match = cfg_kv_regex.match(rec)
      if kv_match:
          k, v = kv_match.groups()
      elif cfg_k_regex.match(rec):
          # could be just a key without = value, which git treats as True
          # if asked for a bool
          k, v = rec, None
      else:
          # no value, no good key
          k = v = None
      return k, v
  
imports: import json
  import logging
  import os
  import re
  import threading
  import warnings
  from collections import namedtuple
  from fasteners import InterProcessLock
  from functools import lru_cache, wraps
  from pathlib import Path
  import datalad
  from datalad.consts import DATASET_CONFIG_FILE
  from datalad.runner import CommandError, GitRunner, KillOutput, StdOutErrCapture
  from datalad.utils import getpwd, on_windows
label_desc: Use image node_id 5 for calling a global function with example usage: _gitcfg_rec_to_keyvalue(rec) and returns: k,  v