

def create_digest_traverser(cloudtrail_client, s3_client_provider, trail_arn, trail_source_region=None, on_invalid=None, on_gap=None, on_missing=None, bucket=None, prefix=None):
    'Creates a CloudTrail DigestTraverser and its object graph.\n\n    :type cloudtrail_client: botocore.client.CloudTrail\n    :param cloudtrail_client: Client used to connect to CloudTrail\n    :type s3_client_provider: S3ClientProvider\n    :param s3_client_provider: Used to create Amazon S3 client per/region.\n    :param trail_arn: CloudTrail trail ARN\n    :param trail_source_region: The scanned region of a trail.\n    :param on_invalid: Callback that is invoked when validating a digest fails.\n    :param on_gap: Callback that is invoked when a digest has no link to the\n        previous digest, but there are more digests to validate. This can\n        happen when a trail is disabled for a period of time.\n    :param on_missing: Callback that is invoked when a digest file has been\n        deleted from Amazon S3 but is supposed to be present.\n    :param bucket: Amazon S3 bucket of the trail if it is different than the\n        bucket that is currently associated with the trail.\n    :param prefix: bucket: Key prefix prepended to each digest and log placed\n        in the Amazon S3 bucket if it is different than the prefix that is\n        currently associated with the trail.\n\n    ``on_gap``, ``on_invalid``, and ``on_missing`` callbacks are invoked with\n    the following named arguments:\n\n    - ``bucket`: The next S3 bucket.\n    - ``next_key``: (optional) Next digest key that was found in the bucket.\n    - ``next_end_date``: (optional) End date of the next found digest.\n    - ``last_key``: The last digest key that was found.\n    - ``last_start_date``: (optional) Start date of last found digest.\n    - ``message``: (optional) Message string about the notification.\n    '
    assert_cloudtrail_arn_is_valid(trail_arn)
    account_id = get_account_id_from_arn(trail_arn)
    if (bucket is None):
        trail_info = get_trail_by_arn(cloudtrail_client, trail_arn)
        LOG.debug('Loaded trail info: %s', trail_info)
        bucket = trail_info['S3BucketName']
        prefix = trail_info.get('S3KeyPrefix', None)
    trail_region = trail_arn.split(':')[3]
    trail_name = trail_arn.split('/')[(- 1)]
    digest_provider = DigestProvider(account_id=account_id, trail_name=trail_name, s3_client_provider=trail_region, trail_source_region=trail_source_region, trail_home_region=trail_region)
    return DigestTraverser(digest_provider=digest_provider, starting_bucket=bucket, starting_prefix=prefix, on_invalid=on_invalid, on_gap=on_gap, on_missing=on_missing, public_key_provider=PublicKeyProvider(cloudtrail_client))

dataset/ETHPy150Open aws/aws-cli/awscli/customizations/cloudtrail/validation.py create_digest_traverser/VarMisuse@139/892 `s3_client_provider`->`trail_region`