def download_file()

in src/s3_util.py [0:0]


    def download_file(self, remote_path, local_dir, quite_mode=False):
        """
        Download a single file from s3
        :param quite_mode: If False, prints the status of each file downloaded
        :param remote_path: The remote s3 file
        :param local_dir: The local directory to save the file to
        :return:
        """
        start = datetime.datetime.now()
        bucket, key = self._get_bucketname_key(remote_path)

        s3 = boto3.client('s3')

        local_file = os.path.join(local_dir, remote_path.split("/")[-1])

        # This is to avoid boto3 s3_download file attempting to create the same local path across multiple calls resulting in filnotfounderror
        if not os.path.exists(local_dir):
            Path(local_dir).mkdir(parents=True, exist_ok=True)

        s3.download_file(bucket, key, local_file)

        if not quite_mode:
            download_time = datetime.datetime.now() - start

            print("Downloaded file from {} to {} in {} seconds".format(remote_path, local_file,
                                                                       download_time.total_seconds()))