input: Write a function to determine if a number is prime using Python. The function should include a nested helper function for testing divisibility and should return True if the number is prime and False otherwise.
  assert is_prime(5)==True
  assert is_prime(4)==False
  assert is_prime(7)==True
  assert is_prime(9)==False
  assert is_prime(2)==True
output: def is_prime(n):
      def is_divisible(x, y):
          return x % y == 0
      
      if n <= 1:
          return False
      if n == 2:
          return True
      if is_divisible(n, 2):
          return False
      for i in range(3, int(n**0.5) + 1, 2):
          if is_divisible(n, i):
              return False
      return True