thereafterif the list now contains five or fewer elementswe shall sort the medians list and return the element located in its middle indexif len(medians< return sorted(medians)[len(medians)/ ifon the other handthe size of the list is greater than fivewe recursively call the median_of_medians function againsupplying it with the list of the medians stored in medians takefor instancethe following list of numbers[ we can break this list into groups of five elements each with the code statement sublists [elems[ : + for in range( len(elems) )]to obtain the following list[[ ][ ][ ][ ][ ]sorting each of the five-element lists and obtaining their medians produces the following list[ since the list is five elements in sizewe only return the median of the sorted listor we would have made another call to the median_of_median function partitioning step now that we have obtained the approximate medianthe get_index_of_nearest_median function takes the bounds of the list indicated by the first and last parametersdef get_index_of_nearest_median(array_listfirstsecondmedian)if first =secondreturn first elsereturn first array_list[first:secondindex(median