<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def download(self, bundle_uuid, replica, version="", download_dir="", metadata_files=('*',), data_files=('*',), num_retries=10, min_delay_seconds=0.25):
 """ Download a bundle and save it to the local filesystem as a directory. :param str bundle_uuid: The uuid of the bundle to download :param str replica: the replica to download from. The supported replicas are: `aws` for Amazon Web Services, and `gcp` for Google Cloud Platform. [aws, gcp] :param str version: The version to download, else if not specified, download the latest. The version is a timestamp of bundle creation in RFC3339 :param str dest_name: The destination file path for the download :param iterable metadata_files: one or more shell patterns against which all metadata files in the bundle will be matched case-sensitively. A file is considered a metadata file if the `indexed` property in the manifest is set. If and only if a metadata file matches any of the patterns in `metadata_files` will it be downloaded. :param iterable data_files: one or more shell patterns against which all data files in the bundle will be matched case-sensitively. A file is considered a data file if the `indexed` property in the manifest is not set. The file will be downloaded only if a data file matches any of the patterns in `data_files` will it be downloaded. :param int num_retries: The initial quota of download failures to accept before exiting due to failures. The number of retries increase and decrease as file chucks succeed and fail. :param float min_delay_seconds: The minimum number of seconds to wait in between retries. Download a bundle and save it to the local filesystem as a directory. By default, all data and metadata files are downloaded. To disable the downloading of data files, use `--data-files ''` if using the CLI (or `data_files=()` if invoking `download` programmatically). Likewise for metadata files. If a retryable exception occurs, we wait a bit and retry again. The delay increases each time we fail and decreases each time we successfully read a block. We set a quota for the number of failures that goes up with every successful block read and down with each failure. """

        errors = 0

        with concurrent.futures.ThreadPoolExecutor(self.threads) as executor:
            futures_to_dss_file = {executor.submit(task): dss_file
                                   for dss_file, task in self._download_tasks(bundle_uuid,
                                                                              replica,
                                                                              version,
                                                                              download_dir,
                                                                              metadata_files,
                                                                              data_files,
                                                                              num_retries,
                                                                              min_delay_seconds)}
            for future in concurrent.futures.as_completed(futures_to_dss_file):
                dss_file = futures_to_dss_file[future]
                try:
                    future.result()
                except Exception as e:
                    errors += 1
                    logger.warning('Failed to download file %s version %s from replica %s',
                                   dss_file.uuid, dss_file.version, dss_file.replica, exc_info=e)
        if errors:
            raise RuntimeError('{} file(s) failed to download'.format(errors))