def get_s3_client()

in src/fmeval/data_loaders/data_sources.py [0:0]


def get_s3_client(uri: str) -> boto3.client:
    """
    Util method to return boto3 s3 client. For built-in datasets, the boto3 client region is default to us-west-2 for
        commercial regions as the bucket is not accessible in opt-in regions.
        For us-isof partition, built-in datasets are located in us-isof-south-1 region.

    :param uri: s3 dataset uri
    :return: boto3 s3 client
    """
    session = boto3.session.Session()
    region = session.region_name
    if region in BUILT_IN_DATASET_ISO_REGIONS.keys():
        s3_client = (
            boto3.client("s3", region_name=BUILT_IN_DATASET_ISO_REGIONS[region], verify=False)
            if uri.startswith(BUILT_IN_DATASET_PREFIX)
            else boto3.client("s3", verify=False)
        )
    else:
        s3_client = (
            boto3.client("s3", region_name=BUILT_IN_DATASET_DEFAULT_REGION)
            if uri.startswith(BUILT_IN_DATASET_PREFIX)
            else boto3.client("s3")
        )
    return s3_client