import boto3 def keys_in_s3_location(bucket_name, path): s3 = boto3.resource('s3') bucket = s3.Bucket(bucket_name) return [ 's3://{}/{}'.format(bucket_name, key.key) for key in bucket.objects.filter(Prefix=path)] def chunk_list(l, cunk_size): return [l[i:i + cunk_size] for i in range(0, len(l), cunk_size)]