Optimize the following Python function. The function calculates the sum of squares of two given numbers.
def SumOfSquares(x,y):
    result = x**2 + y**2
    return result
def SumOfSquares(x, y):
 return x * (x + y) + y * y