As a result, if the word we check is: Octopus, then output should be Uboctubopubus, not Octubopubus.
I think the code can be something like this.
def ubbi_dubbi(string):
output = []
if string[0].lower() in "aiueo":
result = f'ub{string[0]}'
else:
result = f'{string[0]}'
if string[0].isupper():
output.append(result.capitalize())
else:
output.append(result)
for each in string[1:]:
if each in "aiueo":
output.append(f'ub{each}')
else:
output.append(each)
return ''.join(output)