<prompt> Andika kazi ya kupata kipengele mara kwa mara zaidi katika safu.  <response>: Heres a Python function that you can use to find the most frequent element in an array:pythondef most_frequentarr: Create a dictionary to store the frequency of each element in the array freq for item in arr: if item in freq: freqitem 1 else: freqitem 1 Find the most frequent element by sorting the dictionary by value most_freq sortedfreq, keyfreq.get, reverseTrue0 return most_freqYou can use this function like this:pythonarr 1, 2, 3, 4, 5, 3, 3, 3, 5, 5, 5, 5, 5printMost Frequent Element:, most_frequentarrThis will return 5 as the most frequent element in the given array. 