# -*- coding: utf-8 -*-"""Resolve what s3 client to use for API call."""importtypingasTfrom..awsimportContextifT.TYPE_CHECKING:# pragma: no coverfromboto_session_managerimportBotoSesManagerfrommypy_boto3_s3importS3Client
[docs]defresolve_s3_client(context:Context,bsm:T.Optional[T.Union["BotoSesManager","S3Client"]]=None,)->"S3Client":""" Figure out the final boto session to use for API call. If ``BotoSesManager`` is defined, then prioritize to use it. If bsm is an pre-defined s3 client, then use it. """ifbsmisNone:returncontext.s3_clientelse:try:returnbsm.s3_clientexceptAttributeError:returnbsm