def deleteUser()

in force_user_mfa/ForceUserMFA.py [0:0]


def deleteUser(userName, SN):
    try:
        response = client.deactivate_mfa_device(
            UserName=userName,
            SerialNumber=SN
        )
        print("MFA device deactivated, trying to delete device.")
    except:
        print("Unable to deactivate MFA token. Could be that it's not created.")
    try:
        response = client.delete_virtual_mfa_device(
            SerialNumber=SN
        )
        print("MFA device deleted, trying to delete new user.")
    except:
        print("Unable to delete MFA token. Could be that it's not created.")
    try:
        response = client.delete_user(
            UserName=userName
        )
        print("User deleted")
    except:
        print("Unable to delete user: " + userName)
    return True