Ok I found a way. You could do something like this
ratio = 1/(x+y)
x *= ratio
y *= ratio

Then the output of x + y will always be 1. The only problem is that if x+y is already less than one this will make it equal to one. To solve that you could just use an if else statement like this
if x+y > 1:
   ratio = 1/(x+y)
   x *= ratio
   y *= ratio
else:
   continue