code: def _credspec2dict(spec):
      """Parser for git-credential input/output format
  
      See `man 1 git-credential` (INPUT/OUTPUT FORMAT)
  
      Parameters
      ----------
      spec : file-like or IO stream
  
      Returns
      -------
      dict
      """
      attrs = {}
      for line in spec:
          if not line:
              # empty line ends specification
              break
          # protocol violations?
          assert "=" in line
          assert line[-1] == "\n"
          k, v = line[:-1].split("=", maxsplit=1)
          # w/o conversion to str this might be a _io.TextWrapper crashing further
          # down the road (for example when passed to re.match):
          attrs[k] = str(v)
      return attrs
  
file_path: datalad/datalad/local/gitcredential.py
imports: from io import StringIO
  from datalad.cmd import GitWitlessRunner, StdOutErrCapture
  from logging import getLogger
label_desc: Use image node_id 1 for calling a global function with example usage: _credspec2dict(spec) and returns: attrs