code: def _create_kms_key(
      kms_client,
      account_id,
      region,
      role_arn=None,
      sagemaker_role="SageMakerRole",
      alias=KEY_ALIAS,
  ):
      if role_arn:
          principal = PRINCIPAL_TEMPLATE.format(
              partition=utils._aws_partition(region),
              account_id=account_id,
              role_arn=role_arn,
              sagemaker_role=sagemaker_role,
          )
      else:
          principal = '"{account_id}"'.format(account_id=account_id)
  
      response = kms_client.create_key(
          Policy=KEY_POLICY.format(
              id=POLICY_NAME,
              principal=principal,
              sagemaker_role=sagemaker_role,
          ),
          Description="KMS key for SageMaker Python SDK integ tests",
      )
      key_arn = response["KeyMetadata"]["Arn"]
  
      if alias:
          kms_client.create_alias(
              AliasName="alias/" + alias, TargetKeyId=key_arn
          )
      return key_arn
  
file_path: sagemaker-python-sdk/tests/integ/kms_utils.py
imports: from __future__ import absolute_import
  import contextlib
  import json
  from sagemaker import utils
label_desc: Use image node_id 3 for calling a global function with example usage: _create_kms_key(kms_client, account_id, region, role_arn, sagemaker_role, alias) and returns: key_arn