code: def s3_fs():
      if should_skip(S3_URI):
          yield [None] * NUM_ATR_FS
          return
  
      import boto3
  
      monkeypatch = pytest.MonkeyPatch()
      bucket_name = os.environ.get("S3_TEST_BUCKET")
      client = None
  
      # This means we are running against emulator.
      if bucket_name is None:
          endpoint_url = "http://localhost:4566"
          monkeypatch.setenv("AWS_REGION", "us-east-1")
          monkeypatch.setenv("AWS_ACCESS_KEY_ID", "TEST")
          monkeypatch.setenv("AWS_SECRET_ACCESS_KEY", "TEST")
          monkeypatch.setenv("S3_ENDPOINT", endpoint_url)
  
          bucket_name = f"tf-io-bucket-s3-{int(time.time())}"
          client = boto3.client("s3", endpoint_url=endpoint_url)
          client.create_bucket(Bucket=bucket_name)
      else:
          # TODO(vnvo2409): Implement for testing against production scenario
          pass
  
      client.put_object(Bucket=bucket_name, Key=ROOT_PREFIX, Body="")
  
      def parse(path):
          res = urlparse(path, scheme=S3_URI, allow_fragments=False)
          return res.netloc, res.path[1:]
  
      def path_to(*args):
          return f"{S3_URI}://{bucket_name}/{posixpath.join(ROOT_PREFIX, *args)}"
  
      def read(path):
          bucket_name, key_name = parse(path)
          response = client.get_object(Bucket=bucket_name, Key=key_name)
          return response["Body"].read()
  
      def write(path, body):
          bucket_name, key_name = parse(path)
          client.put_object(Bucket=bucket_name, Key=key_name, Body=body)
  
      def mkdirs(path):
          if path[-1] != "/":
              path += "/"
          write(path, b"")
  
      yield path_to, read, write, mkdirs, posixpath.join, (
          client,
          bucket_name,
      )
      monkeypatch.undo()
  
imports: import functools
  import os
  import posixpath
  import random
  import socket
  import sys
  import time
  from urllib.parse import urlparse
  import pytest
  import tensorflow
  import tensorflow_io
label_desc: Use image node_id 4 for calling a global function with example usage: s3_fs() and returns: res,  res, S3_URI, str, bucket_name, str, posixpath, response