Hi@akhtar,
You can use botocore.exceptions package in your script. It will allow you to manage the exceptions. I have attached one example below for your reference.
import boto3
from botocore.exceptions import ClientError
try:
    iam = boto3.client('iam')
    user = iam.create_user(UserName='fred')
    print("Created user: %s" % user)
except ClientError as e:
    if e.response['Error']['Code'] == 'EntityAlreadyExists':
        print("User already exists")
    else:
        print("Unexpected error: %s" % e)