code: def save_directory(self, source_dir, target_name):
      import boto3
  
      # Stolen from:
      # https://github.com/boto/boto3/issues/358#issuecomment-346093506
      target_name = target_name or os.path.basename(source_dir)
      all_files = []
      for root, dirs, files in os.walk(source_dir):
          all_files += [os.path.join(root, f) for f in files]
      s3_resource = boto3.resource("s3")
  
      for filename in all_files:
          file_location = s3_join(
              self.dir,
              target_name,
              os.path.relpath(filename, source_dir),
          )
          s3_resource.Object(self.bucket, file_location).put(
              Body=open(filename, "rb")
          )
  
imports: import json
  import os
  import os.path
  from sacred.commandline_options import cli_option
  from sacred.dependencies import get_digest
  from sacred.observers.base import RunObserver
  from sacred.serializer import flatten
  import re
  import socket
label_desc: Use image node_id 14 for calling the S3Observer obj's underlying member method code with example usage: obj.save_directory(source_dir, target_name) without return types