
    Develop a function that enhances patient privacy in the emergency room tracking system by transforming identification codes through selective character reversal, specifically targeting only vowel positions while maintaining consonant placements in their original order. The transformation must preserve the code's retrievability by only reversing the sequence of vowels (a, e, i, o, u) within the ID string, keeping all other characters unchanged.
    

    
def reverse_vowels(str1):
    """
    Develop a function that enhances patient privacy in the emergency room tracking system by transforming identification codes through selective character reversal, specifically targeting only vowel positions while maintaining consonant placements in their original order. The transformation must preserve the code's retrievability by only reversing the sequence of vowels (a, e, i, o, u) within the ID string, keeping all other characters unchanged.
    

    """
def reverse_vowels(str1):
    """
    Develop a function that enhances patient privacy in the emergency room tracking system by transforming identification codes through selective character reversal, specifically targeting only vowel positions while maintaining consonant placements in their original order. The transformation must preserve the code's retrievability by only reversing the sequence of vowels (a, e, i, o, u) within the ID string, keeping all other characters unchanged.
    

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