def get_all_objects_in_bucket(
        aws_bucket_name,
        s3_client=None,
        max_keys=1000
):
    """
    Little utility method that handles pagination and returns
    all objects in given bucket.
    """
    logger.debug("Retrieving bucket object list")

    if not s3_client:
        s3_client, s3_resource = get_s3_client()

    obj_dict = {}
    paginator = s3_client.get_paginator('list_objects')
    page_iterator = paginator.paginate(Bucket=aws_bucket_name)
    for page in page_iterator:
        key_list = page.get('Contents', [])
        logger.debug("Loading page with {} keys".format(len(key_list)))
        for obj in key_list:
            obj_dict[obj.get('Key')] = obj
    return obj_dict
Little utility method that handles pagination and returns
    all objects in given bucket.