code: def test_get_recursive(
      inject_failure_rate, s3root, prefixes, expected
  ):
      expected_exists = {
          url: v
          for url, v in expected.items()
          if v[None].size is not None
      }
      local_files = []
      with S3(
          s3root=s3root, inject_failure_rate=inject_failure_rate
      ) as s3:
          s3objs = s3.get_recursive(prefixes)
  
          # we need to deduce which prefixes actually produce results
          nonempty_prefixes = list(
              filter(
                  lambda p: any(
                      url.startswith(os.path.join(s3root, p))
                      for url in expected_exists
                  ),
                  prefixes,
              )
          )
  
          # prefixes must be returned in the order of prefixes requested
          plen = len(s3root)
          grouped = list(groupby(s3objs, lambda e: e.prefix[plen:]))
  
          assert nonempty_prefixes == [prefix for prefix, _ in grouped]
          # for each prefix, the results should be in lexicographic order
          for prefix, objs in grouped:
              urls = [e.url for e in objs]
              assert list(sorted(urls)) == urls
  
          assert_results(
              s3objs, expected_exists, info_should_be_empty=True
          )
  
          # if there are multiple prefixes, it is a bit harder to know
          # what's the expected set of results. We do this test only
          # for the single-prefix case for now
          if len(prefixes) == 1:
              [prefix] = prefixes
              s3root = os.path.join(s3root, prefix)
              keys = {url[len(s3root) + 1 :] for url in expected_exists}
              assert {e.key for e in s3objs} == keys
  
          local_files = [s3obj.path for s3obj in s3objs]
      # local files must not exist outside the S3 context
      for path in local_files:
          assert not os.path.exists(path)
  
imports: import os
  from re import I
  import shutil
  from hashlib import sha1
  from tempfile import mkdtemp
  from itertools import groupby, starmap
  import random
  from uuid import uuid4
  from metaflow.plugins.datatools import s3
  import pytest
  from metaflow import current, namespace, Run
  from metaflow.plugins.datatools.s3 import S3, MetaflowS3AccessDenied, MetaflowS3NotFound, MetaflowS3URLException, MetaflowS3InvalidObject, S3PutObject, S3GetObject
  from metaflow.util import to_bytes, unicode_type
  from .None import s3_data
  from ..None import FakeFlow, DO_TEST_RUN
label_desc: Use image node_id 23 for calling a global function with example usage: test_get_recursive(inject_failure_rate, s3root, prefixes, expected) without return types