Transform a nested list to a flattened list. Hint, lookup the predicate is_list/1.

?- my_flatten([a, [b, [c, d], e]], X).
X = [a, b, c, d, e]

It is sufficient if your code works as demonstrated above, with a list as first parameter.