code: def test_with_result_progress_generator():
      # Tests ability for the decorator to decorate a regular function
      # or a generator function (then it returns a generator function)
  
      @with_result_progress
      def func(l):
          return l
  
      generated = []
  
      @with_result_progress
      def gen(l):
          for i in l:
              generated.append(i)
              yield i
  
      recs = [{"status": "ok", "unrelated": i} for i in range(2)]
      # still works for a func and returns provided list
      ok_(not inspect.isgeneratorfunction(func))
      assert_equal(func(recs), recs)
  
      # generator should still yield and next iteration should only happen
      # when requested
      ok_(inspect.isgeneratorfunction(gen))
      g = gen(recs)
  
      ok_generator(g)
      assert_equal(generated, [])  # nothing yet
      assert_equal(next(g), recs[0])
      assert_equal(generated, recs[:1])
      assert_equal(next(g), recs[1])
      assert_equal(generated, recs)
  
      # just to make sure all good to redo
      assert_equal(list(gen(recs)), recs)
  
imports: import inspect
  import logging
  import os.path
  from logging import makeLogRecord
  from os.path import exists
  from unittest.mock import patch
  from datalad import cfg
  from datalad.log import ColorFormatter, LoggerHelper, TraceBack, log_progress, with_progress, with_result_progress
  from datalad.support import ansi_colors
  from datalad.support.constraints import EnsureBool
  from datalad.tests.utils_pytest import SkipTest, assert_equal, assert_in, assert_no_open_files, assert_not_in, assert_re_in, known_failure_githubci_win, ok_, ok_endswith, ok_generator, swallow_logs, with_tempfile
  from datalad.utils import on_windows
label_desc: Use image node_id 9 for calling a global function with example usage: test_with_result_progress_generator() and returns: l