code: def _format_test_cases(dataset, meta=None, ranges=None):
      cases = []
      ids = []
      for prefix, filespecs in dataset:
          objs = [
              RandomFile(prefix, fname, size)
              for fname, size in filespecs.items()
          ]
          objs = {obj.url: (obj, None, None) for obj in objs}
          if meta:
              # We generate one per meta info
              for metaname, (content_type, usermeta) in meta.items():
                  objs.update(
                      {
                          "%s_%s"
                          % (obj.url, metaname): (
                              obj,
                              content_type,
                              usermeta,
                          )
                          for (obj, _, _) in objs.values()
                      }
                  )
          files = {
              k: {
                  None: ExpectedResult(
                      size=obj.size,
                      checksum=obj.checksum(),
                      content_type=content_type,
                      metadata=usermeta,
                      range=None,
                  )
              }
              for k, (obj, content_type, usermeta) in objs.items()
          }
          if ranges:
              # For every file we have in files, we calculate the proper
              # checksum and create a new dictionary
              for k, (obj, content_type, usermeta) in objs.items():
                  for offset, length in ranges.values():
                      expected_size, real_offset = obj.size_from_range(
                          offset, length
                      )
                      if (
                          expected_size is None
                          or expected_size > obj.size
                      ):
                          continue
                      files[k][(offset, length)] = ExpectedResult(
                          size=expected_size,
                          checksum=obj.checksum(offset, length),
                          content_type=content_type,
                          metadata=usermeta,
                          range=ExpectedRange(
                              total_size=obj.size,
                              result_offset=real_offset,
                              result_size=expected_size,
                              req_offset=offset,
                              req_size=length,
                          ),
                      )
  
          ids.append(prefix)
          cases.append((S3ROOT, [prefix], files))
      return cases, ids
  
imports: import os
  import sys
  import zlib
  import json
  from uuid import uuid4
  from hashlib import sha1
  from collections import namedtuple
  from metaflow.plugins.datatools.s3 import S3PutObject
  from metaflow.util import to_fileobj, to_bytes, url_quote
  import numpy
  from ..None import s3client, S3ROOT
label_desc: Use image node_id 1 for calling a global function with example usage: _format_test_cases(dataset, meta, ranges) and returns: cases,  ids