Generate a Python program that has the following intention:

The intention of the program below is to write a function p1(arr) that takes a list of lists as input, flattens the nested lists, and returns the flattened list in a generator fashion. The function does not modify the input list, and it uses a while loop to iterate through the input list. If the current element is not a list (i.e., not isinstance(x, list)), it simply yields the element. If the current element is a list, it calls the p1 function recursively on the nested list, and yields all the elements found in the nested lists. The function continues this process until it reaches the end of the input list. Provide response in all capital letters, no lowercase letters allowed.
user