def create_profile_name_from_role_arn(
    role_arn, account_alias, profile_name_format
):
    """Create a profile name for a give role ARN and account alias."""
    profile_name = role_arn.split("role/")[-1].replace("/", "-")
    if profile_name_format == "RoleName-AccountAlias":
        return f"{profile_name}-{account_alias}"
    return profile_name