
    In a ride-sharing system's route optimization algorithm, develop a function that rearranges only the vowels in a route identifier string while keeping all other characters in their original positions. This transformation helps generate alternative route patterns while preserving critical location-based consonant markers in the identifier string.
    

    
def reverse_vowels(str1):
    """
    In a ride-sharing system's route optimization algorithm, develop a function that rearranges only the vowels in a route identifier string while keeping all other characters in their original positions. This transformation helps generate alternative route patterns while preserving critical location-based consonant markers in the identifier string.
    

    """
def reverse_vowels(str1):
    """
    In a ride-sharing system's route optimization algorithm, develop a function that rearranges only the vowels in a route identifier string while keeping all other characters in their original positions. This transformation helps generate alternative route patterns while preserving critical location-based consonant markers in the identifier string.
    

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