def fetch_s3_package(self, config):
        """Make a remote S3 archive available for local use.

        Args:
            config (dict): git config dictionary

        """
        extractor_map = {'.tar.gz': TarGzipExtractor,
                         '.tar': TarExtractor,
                         '.zip': ZipExtractor}
        extractor = None
        for suffix, klass in extractor_map.items():
            if config['key'].endswith(suffix):
                extractor = klass()
                logger.debug("Using extractor %s for S3 object \"%s\" in "
                             "bucket %s.",
                             klass.__name__,
                             config['key'],
                             config['bucket'])
                dir_name = self.sanitize_uri_path(
                    "s3-%s-%s" % (config['bucket'],
                                  config['key'][:-len(suffix)])
                )
                break

        if extractor is None:
            raise ValueError(
                "Archive type could not be determined for S3 object \"%s\" "
                "in bucket %s." % (config['key'], config['bucket'])
            )

        session = get_session(region=None)
        extra_s3_args = {}
        if config.get('requester_pays', False):
            extra_s3_args['RequestPayer'] = 'requester'

        # We can skip downloading the archive if it's already been cached
        if config.get('use_latest', True):
            try:
                # LastModified should always be returned in UTC, but it doesn't
                # hurt to explicitly convert it to UTC again just in case
                modified_date = session.client('s3').head_object(
                    Bucket=config['bucket'],
                    Key=config['key'],
                    **extra_s3_args
                )['LastModified'].astimezone(dateutil.tz.tzutc())
            except botocore.exceptions.ClientError as client_error:
                logger.error("Error checking modified date of "
                             "s3://%s/%s : %s",
                             config['bucket'],
                             config['key'],
                             client_error)
                sys.exit(1)
            dir_name += "-%s" % modified_date.strftime(self.ISO8601_FORMAT)
        cached_dir_path = os.path.join(self.package_cache_dir, dir_name)
        if not os.path.isdir(cached_dir_path):
            logger.debug("Remote package s3://%s/%s does not appear to have "
                         "been previously downloaded - starting download and "
                         "extraction to %s",
                         config['bucket'],
                         config['key'],
                         cached_dir_path)
            tmp_dir = tempfile.mkdtemp(prefix='stacker')
            tmp_package_path = os.path.join(tmp_dir, dir_name)
            try:
                extractor.set_archive(os.path.join(tmp_dir, dir_name))
                logger.debug("Starting remote package download from S3 to %s "
                             "with extra S3 options \"%s\"",
                             extractor.archive,
                             str(extra_s3_args))
                session.resource('s3').Bucket(config['bucket']).download_file(
                    config['key'],
                    extractor.archive,
                    ExtraArgs=extra_s3_args
                )
                logger.debug("Download complete; extracting downloaded "
                             "package to %s",
                             tmp_package_path)
                extractor.extract(tmp_package_path)
                logger.debug("Moving extracted package directory %s to the "
                             "Stacker cache at %s",
                             dir_name,
                             self.package_cache_dir)
                shutil.move(tmp_package_path, self.package_cache_dir)
            finally:
                shutil.rmtree(tmp_dir)
        else:
            logger.debug("Remote package s3://%s/%s appears to have "
                         "been previously downloaded to %s -- bypassing "
                         "download",
                         config['bucket'],
                         config['key'],
                         cached_dir_path)

        # Update sys.path & merge in remote configs (if necessary)
        self.update_paths_and_config(config=config,
                                     pkg_dir_name=dir_name)
Make a remote S3 archive available for local use.

        Args:
            config (dict): git config dictionary