
    Develop a security encoding function for transaction identifiers that reverses only the vowel positions within the authentication token while preserving all other characters, as part of the bank's pattern-masking protocol. The encoding must maintain the original token length and character set composition, where 'y' is treated as a consonant per banking standards.
    

    
def reverse_vowels(str1):
    """
    Develop a security encoding function for transaction identifiers that reverses only the vowel positions within the authentication token while preserving all other characters, as part of the bank's pattern-masking protocol. The encoding must maintain the original token length and character set composition, where 'y' is treated as a consonant per banking standards.
    

    """
def reverse_vowels(str1):
    """
    Develop a security encoding function for transaction identifiers that reverses only the vowel positions within the authentication token while preserving all other characters, as part of the bank's pattern-masking protocol. The encoding must maintain the original token length and character set composition, where 'y' is treated as a consonant per banking standards.
    

    """
    vowels = ''
    for char in str1:
        if char in 'aeiouAEIOU':
            vowels += char
    result_string = ''
    for char in str1:
        if char in 'aeiouAEIOU':
            result_string += vowels[-1]
            vowels = vowels[:-1]
        else:
            result_string += char
    return result_string