Part of my homework involves making a function which checks if a number is a sum of two squares. Problem is that it takes a very long time for larger numbers to run through it. Any suggestions on how to make this more efficient? for example, given the number `50` it would return `(7,1)` since 7^2 is 49 and 1^2 is 1 so the total would be 50
Here's the code:

```
def sum_of_squares(n) : 
  i = 1 

  while i * i <= n : 
      j = 1

      while(j * j <= n) : 

          while (i * i + j * j == n) : 

              return (j,i)

          j = j + 1
      i = i + 1

```