def download_dir(bucket, prefix, local_path, client=s3_client):
    '\n    Usage: [arg1]:[bucket name],[arg2]:[pattern to match keys in s3],[arg3]:[local path to folder in which to place files],[arg4]:[initialized s3 client object],\n    Description: Downloads the contents to the local path\n    '
    keys = []
    dirs = set()
    next_token = ''
    base_kwargs = {'Bucket': bucket, 'Prefix': prefix}
    local = ((local_path + bucket) + '\\')
    while (next_token is not None):
        kwargs = base_kwargs.copy()
        if (next_token != ''):
            kwargs.update({'ContinuationToken': next_token})
        results = client.list_objects_v2(**kwargs)
        contents = results.get('Contents')
        for i in contents:
            k = i.get('Key')
            keys.append(k)
            dirs.add(k[:(k.rfind('/') + 1)])
        next_token = results.get('NextContinuationToken')
    for d in dirs:
        dest_pathname = os.path.join(local, d)
        if (not os.path.exists(os.path.dirname(dest_pathname))):
            os.makedirs(os.path.dirname(dest_pathname))
    for k in keys:
        dest_pathname = os.path.join(local, k)
        if (not os.path.exists(os.path.dirname(dest_pathname))):
            os.makedirs(os.path.dirname(dest_pathname))
        client.download_file(bucket, k, dest_pathname)
Usage: [arg1]:[bucket name],[arg2]:[pattern to match keys in s3],[arg3]:[local path to folder in which to place files],[arg4]:[initialized s3 client object],
Description: Downloads the contents to the local path
def download_dir(bucket, prefix, local_path, client=s3_client):
    '\n    Usage: [arg1]:[bucket name],[arg2]:[pattern to match keys in s3],[arg3]:[local path to folder in which to place files],[arg4]:[initialized s3 client object],\n    Description: Downloads the contents to the local path\n    '
    keys = []
    dirs = set()
    next_token = 
    base_kwargs = {'Bucket': bucket, 'Prefix': prefix}
    local = ((local_path + bucket) + '\\')
    while (next_token is not None):
        kwargs = base_kwargs.copy()
        if (next_token != ):
            kwargs.update({'ContinuationToken': next_token})
        results = client.list_objects_v2(**kwargs)
        contents = results.get('Contents')
        for i in contents:
            k = i.get('Key')
            keys.append(k)
            dirs.add(k[:(k.rfind('/') + 1)])
        next_token = results.get('NextContinuationToken')
    for d in dirs:
        dest_pathname = os.path.join(local, d)
        if (not os.path.exists(os.path.dirname(dest_pathname))):
            os.makedirs(os.path.dirname(dest_pathname))
    for k in keys:
        dest_pathname = os.path.join(local, k)
        if (not os.path.exists(os.path.dirname(dest_pathname))):
            os.makedirs(os.path.dirname(dest_pathname))
        client.download_file(bucket, k, dest_pathname)