code: def _readline_rstripped(stdout):
      """Internal helper for BatchedCommand"""
      return stdout.readline().rstrip()
  
imports: from __future__ import annotations
  import logging
  import os
  import queue
  import sys
  import warnings
  from datetime import datetime
  from operator import attrgetter
  from queue import Queue
  from subprocess import TimeoutExpired
  from typing import Any, Callable, List, Optional, Tuple, Union
  from weakref import ReferenceType, WeakValueDictionary, ref
  from datalad import cfg
  from datalad.runner.coreprotocols import KillOutput, NoCapture, StdErrCapture, StdOutCapture, StdOutErrCapture
  from datalad.runner.gitrunner import GIT_SSH_COMMAND, GitRunnerBase, GitWitlessRunner
  from datalad.runner.nonasyncrunner import STDERR_FILENO, STDOUT_FILENO, _ResultGenerator, run_command
  from datalad.runner.protocol import GeneratorMixIn, WitlessProtocol
  from datalad.runner.runner import WitlessRunner
  from datalad.runner.utils import LineSplitter
  from datalad.support.exceptions import CommandError
  from datalad.utils import auto_repr, ensure_unicode
label_desc: Use image node_id 2 for calling a global function with example usage: _readline_rstripped(stdout) and returns: stdout