def flatten_to_strings(listOfLists):
    """Flatten a list of (lists of (lists of strings)) for any level 
    of nesting"""
result = []
for i in listOfLists:
    if isinstance(i, str):
        result.append(i)
else:
    result.extend(flatten_to_strings(i))
return result
flatten_to_strings(list_of_menuitems)
Flatten a list of strings and lists of strings and lists in Python