
    Develop a security encoding function for transaction identifiers that masks sensitive data by reversing only the vowel positions within the identifier string while maintaining all other characters in their original positions, where this selective reversal serves as a first-layer encryption mechanism in the bank's transaction monitoring system. The function should treat 'y' as a consonant and preserve the original string length.
    

    
def reverse_vowels(str1):
    """
    Develop a security encoding function for transaction identifiers that masks sensitive data by reversing only the vowel positions within the identifier string while maintaining all other characters in their original positions, where this selective reversal serves as a first-layer encryption mechanism in the bank's transaction monitoring system. The function should treat 'y' as a consonant and preserve the original string length.
    

    """
def reverse_vowels(str1):
    """
    Develop a security encoding function for transaction identifiers that masks sensitive data by reversing only the vowel positions within the identifier string while maintaining all other characters in their original positions, where this selective reversal serves as a first-layer encryption mechanism in the bank's transaction monitoring system. The function should treat 'y' as a consonant and preserve the original string length.
    

    """
    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