code: def create_user_with_access_key_and_attached_policy(
      region_name: Text,
  ) -> Any:
      """Create a user and an access key for them."""
      client = boto3.client("iam", region_name=region_name)
      # deepcode ignore NoHardcodedCredentials/test: Test credential
      client.create_user(UserName="test_user")
  
      policy_document = {
          "Version": "2012-10-17",
          "Statement": [
              {
                  "Sid": "AllObjectActions",
                  "Effect": "Allow",
                  "Action": "s3:*Object",
                  "Resource": [f"arn:aws:s3:::{bucket_name}/*"],
              }
          ],
      }
  
      policy_arn = client.create_policy(
          PolicyName="test_policy",
          PolicyDocument=json.dumps(policy_document),
      )["Policy"]["Arn"]
      client.attach_user_policy(
          UserName="test_user", PolicyArn=policy_arn
      )
  
      return client.create_access_key(UserName="test_user")["AccessKey"]
  
file_path: rasa/tests/integration_tests/core/test_agent.py
imports: import json
  import os
  from pathlib import Path
  from typing import Any, Text
  import boto3
  import pytest
  from moto import mock_iam, mock_s3
  from pytest import MonkeyPatch
  from rasa.core.agent import Agent
  from rasa.nlu.persistor import AWSPersistor
  from rasa.shared.exceptions import RasaException
label_desc: Use image node_id 4 for calling a global function with example usage: create_user_with_access_key_and_attached_policy(region_name) and returns: client