
    Design a transaction encoding function for the bank's fraud detection system that enhances security by reversing only the vowels within transaction description texts while maintaining the original consonant positions. The encoding mechanism must process all standard vowels (a, e, i, o, u) in both uppercase and lowercase forms, leaving all other characters, including 'y', unchanged in their original positions.
    

    
def reverse_vowels(str1):
    """
    Design a transaction encoding function for the bank's fraud detection system that enhances security by reversing only the vowels within transaction description texts while maintaining the original consonant positions. The encoding mechanism must process all standard vowels (a, e, i, o, u) in both uppercase and lowercase forms, leaving all other characters, including 'y', unchanged in their original positions.
    

    """
def reverse_vowels(str1):
    """
    Design a transaction encoding function for the bank's fraud detection system that enhances security by reversing only the vowels within transaction description texts while maintaining the original consonant positions. The encoding mechanism must process all standard vowels (a, e, i, o, u) in both uppercase and lowercase forms, leaving all other characters, including 'y', unchanged in their original positions.
    

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