<prompt> Write a function to check if an integer is a prime number.  <response>: Sure, here is a function written in Python that checks if a given integer is a prime number:pythondef is_primen: if n 1: return False for i in range2, n: if n i 0: return False return TrueThis function takes an integer n as an input and returns a boolean value indicating whether the integer is a prime number or not. The function checks if the integer is less than or equal to 1, and if so, it returns False because 1 is not a prime number.If the integer is greater than 1, the function enters a loop where it checks if the integer is divisible by any number from 2 to n-1. If it is divisible by any of these numbers, the function returns False, indicating that the integer is not a prime number. If the integer is not divisible by any of these numbers, the function returns True, indicating that the integer is a prime number. 