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):
 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=s3_client_provider, 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))

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 ) : 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 = s3_client_provider , 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 ) )
creates a cloudtrail digesttraverser and its object graph .