<prompt> Andika kazi ufanisi kuangalia kama integer ni idadi ya kwanza.  <response>: Sure, heres an example implementation of a function:def is_primen: if n 1: return False for i in range2, intn0.5 1: if n i 0: return False return TrueHeres how this function works:1. We first check if the input integer n is less than or equal to 1, because we know that 1 and all negative numbers are not prime. If n is 1 or less, we return False.2. We then loop from 2 to the square root of n rounded up to the nearest integer using intn0.5 1, because any factor of n greater than the square root of n would necessarily have a corresponding factor less than the square root of n. For each number i in this range, we check if n is evenly divisible by i. If it is, then n is not prime and we can return False.3. If weve finished looping through all possible factors of n without finding any that divide it evenly, then n must be prime and we can return True. 