
    Given a transaction identifier string, write a function that enhances its security by reversing only the sensitive segments (represented by vowels a, e, i, o, u) while keeping all other characters in their original positions. The reversed vowel pattern serves as an additional security layer for transaction encoding, making it more difficult for unauthorized parties to identify patterns in transaction IDs.
    

    
def reverse_vowels(str1):
    """
    Given a transaction identifier string, write a function that enhances its security by reversing only the sensitive segments (represented by vowels a, e, i, o, u) while keeping all other characters in their original positions. The reversed vowel pattern serves as an additional security layer for transaction encoding, making it more difficult for unauthorized parties to identify patterns in transaction IDs.
    

    """
def reverse_vowels(str1):
    """
    Given a transaction identifier string, write a function that enhances its security by reversing only the sensitive segments (represented by vowels a, e, i, o, u) while keeping all other characters in their original positions. The reversed vowel pattern serves as an additional security layer for transaction encoding, making it more difficult for unauthorized parties to identify patterns in transaction IDs.
    

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