code: def __download_from_s3(self, key, dest_dir):
          
          log = logging.getLogger(self.cls_logger + '.__download_from_s3')
          filename = key.split('/')[-1]
          if filename is None:
              log.error('Could not determine the filename from key: %s', key)
              return None
          destination = dest_dir + '/' + filename
          log.info('Attempting to download %s from bucket %s to destination %s',
                   key, self.bucket_name, destination)
          max_tries = 10
          count = 1
          while count <= max_tries:
              log.info('Attempting to download file %s, try %s of %s', key,
                       count, max_tries)
              try:
                  self.s3client.download_file(
                      Bucket=self.bucket_name, Key=key, Filename=destination)
              except ClientError:
                  if count >= max_tries:
                      _, ex, trace = sys.exc_info()
                      msg = 'Unable to download key {k} from S3 bucket {b}:\n{e}'.format(
                          k=key, b=self.bucket_name, e=str(ex))
                      log.error(msg)
                      raise S3UtilError, msg, trace
                  else:
                      log.warn('Download failed, re-trying...')
                      count += 1
                      time.sleep(5)
                      continue
              else:
                  log.info('Successfully downloaded %s from S3 bucket %s to: %s',
                           key,
                           self.bucket_name,
                           destination)
                  return destination
docs: Private method for downloading from S3
  
          This private helper method takes a key and the full path to
          the destination directory, assumes that the args have been
          validated by the public caller methods, and attempts to
          download the specified key to the dest_dir.
  
          :param key: (str) S3 key for the file to be downloaded
          :param dest_dir: (str) Full path destination directory
          :return: (str) Downloaded file destination if the file was
              downloaded successfully, None otherwise.