code: def _download_dir(self, key, local):
      self.logger.debug(
          "s3 download dir.: bucket: {0} key: {1} to {2}".format(
              self.bucket, key, local
          )
      )
  
      success: bool = True
      paginator = self.client.get_paginator("list_objects")
      for result in paginator.paginate(
          Bucket=self.bucket, Delimiter="/", Prefix=key
      ):
          if result.get("CommonPrefixes") is not None:
              for subdir in result.get("CommonPrefixes"):
                  prefix: str = subdir.get("Prefix")
                  local_prefix: str = re.sub("^" + key, "", prefix)
                  dir_success: bool = self._download_dir(
                      prefix, os.path.join(local, local_prefix)
                  )
                  success = success and dir_success
  
          if result.get("Contents") is not None:
              for file in result.get("Contents"):
                  file_key = file.get("Key")
  
                  local_dir_path: str = local
                  if not os.path.exists(local_dir_path):
                      os.makedirs(local_dir_path)
  
                  local_path = os.path.join(
                      local, re.sub("^" + key, "", file_key)
                  )
                  self.logger.debug(
                      "Downloading {0}/{1} to {2}".format(
                          self.bucket, file_key, local_path
                      )
                  )
                  success = (
                      self.download_file(file_key, local_path)
                      and success
                  )
      return success
  
imports: import calendar
  import os
  from urllib.parse import urlparse
  from boto3.s3.transfer import TransferConfig
  from boto3.session import Session
  import botocore
  from botocore.client import Config
  from botocore.handlers import set_list_objects_encoding_type_url
  from typing import Dict
  import re
  from studio.util import logs
  from studio.util import util
  from studio.credentials.credentials import Credentials, AWS_TYPE
  from studio.storage.storage_handler import StorageHandler
  from studio.storage.storage_type import StorageType
  from studio.storage.storage_setup import get_storage_verbose_level
label_desc: Use image node_id 8 for calling the S3StorageHandler obj's underlying member method code with example usage: obj._download_dir(key, local) and returns: success