code: def objects_list(bucket_name):
      """Implement the 'Objects: list' API: return the objects in a bucket."""
      # Lookup the bucket, if this fails the bucket does not exist, and this
      # function should return an error.
      base_url = flask.url_for("gcs_index", _external=True)
      insert_magic_bucket(base_url)
      _ = testbench_utils.lookup_bucket(bucket_name)
      result = {"next_page_token": "", "items": [], "prefixes:": []}
      versions_parameter = flask.request.args.get("versions")
      all_versions = versions_parameter is not None and bool(
          versions_parameter
      )
      prefixes = set()
      prefix = flask.request.args.get("prefix", "", str)
      delimiter = flask.request.args.get("delimiter", "", str)
      start_offset = flask.request.args.get("startOffset", "", str)
      end_offset = flask.request.args.get("endOffset", "", str)
      bucket_link = bucket_name + "/o/"
      for name, o in testbench_utils.all_objects():
          if name.find(bucket_link + prefix) != 0:
              continue
          if o.get_latest() is None:
              continue
          # We assume `delimiter` has only one character.
          if name[len(bucket_link) :] < start_offset:
              continue
          if (
              end_offset != ""
              and name[len(bucket_link) :] >= end_offset
          ):
              continue
          delimiter_index = name.find(
              delimiter, len(bucket_link + prefix)
          )
          if delimiter != "" and delimiter_index > 0:
              # We don't want to include `bucket_link` in the returned prefix.
              prefixes.add(name[len(bucket_link) : delimiter_index + 1])
              continue
          if all_versions:
              for object_version in o.revisions.values():
                  result["items"].append(object_version.metadata)
          else:
              result["items"].append(o.get_latest().metadata)
      result["prefixes"] = list(prefixes)
      return testbench_utils.filtered_response(flask.request, result)
  
imports: import argparse
  import error_response
  import flask
  import gcs_bucket
  import gcs_object
  import json
  import os
  import re
  import testbench_utils
  import time
  import sys
  from werkzeug import serving
  from werkzeug.middleware.dispatcher import DispatcherMiddleware
label_desc: Use image node_id 14 for calling a global function with example usage: objects_list(bucket_name) and returns: testbench_utils