Like Steven says, it doesn't belong to anything but the function itself. What we've done is turn to a simple binary solution set. True or False, and foregone all other checks and tests. Two possible outcomes, two return statements.

Can we refine this code a bit more? Yes. We can make it more efficient by limiting the number of test cases. Take for instance the upper bound of the loop range. Does it need to be `x`

or can work with a smaller number?

Answer: We have two choices of smaller numbers along two lines of reasoning:

A number greater than half of another number cannot be a factor of that number. so `int(x / 2) + 1`

is a viable range. If we add 1 to that, then x / 2 is included in the range.

The factors of a number have at least one corresponding factor in the range of 2 to the square root of x. Make this an integer and add 1 to ensure that the maximum is in the range. So, `int(x ** 0.5) + 1`

Eg. 3 * 9 == 27, but then so does 9 * 3. The commutative property allows us to multiply in any order. It follows that once we find 3, we will find 9 so we don't need to look for 9, just the 3.

Another refinement would be in the step value of the range. However we need to add more logic to make this work.

```
def is_prime(x):
if x < 2: return False
if x > 2:
s = 2 if n > 2 else 1
for n in range(2, int(x ** 0.5) + 1, s):
if x % n == 0: return False
return True
```

Now the program will iterate through only the odd numbers in the range, except 2. Since the first iteration cycle catches all even values for x anyways, there is no reason to iterate over them.