class_docstr: Store and load checkpoints from S3.
code: def download(
      self,
      src: str,
      dst: Union[str, os.PathLike],
      selector: Optional[storage.Selector] = None,
  ) -> None:
      import botocore
  
      dst = os.fspath(dst)
      prefix = self.get_storage_prefix(src)
      logger.info(f"Downloading {prefix} from S3")
      found = False
  
      try:
          for obj in self.bucket.objects.filter(Prefix=prefix):
              found = True
              relname = os.path.relpath(obj.key, prefix)
              if obj.key.endswith("/"):
                  relname = os.path.join(relname, "")
  
              if selector is not None and not selector(relname):
                  continue
              _dst = os.path.join(dst, relname)
              dst_dir = os.path.dirname(_dst)
              os.makedirs(dst_dir, exist_ok=True)
  
              logger.debug(
                  f"Downloading s3://{self.bucket_name}/{obj.key} to {_dst}"
              )
  
              # Only create empty directory for keys that end with "/".
              # See `upload` method for more context.
              if obj.key.endswith("/"):
                  os.makedirs(_dst, exist_ok=True)
                  continue
  
              self.bucket.download_file(obj.key, _dst)
  
      except botocore.exceptions.ClientError as e:
          if e.response["Error"]["Code"] == "AccessDenied":
              raise errors.NoDirectStorageAccess(
                  "Unable to access cloud checkpoint storage"
              ) from e
          raise
  
      except botocore.exceptions.NoCredentialsError as e:
          raise errors.NoDirectStorageAccess(
              "Unable to access cloud checkpoint storage"
          ) from e
  
      if not found:
          raise errors.CheckpointNotFound(
              f"Did not find {prefix} in S3"
          )
  
file_path: determined/harness/determined/common/storage/s3.py
imports: import logging
  import os
  import re
  import tempfile
  from typing import Dict, List, Optional, Union
  import requests
  from determined import errors
  from determined.common import storage, util
label_desc: Use image node_id 4 for calling the S3StorageManager obj's underlying member method code with example usage: obj.download(src, dst, selector) without return types