You need the whole line for it to work, it's called a ternary function, meaning it takes three arguments.
return flatten(hold) if any(type(part) == list for part in hold) else hold
So the first thing it see is the
return this statement, after that is notices that I have a ternary function and it proceeds to follow the instructions.
in this case I have it doing a check to see if it is a list in any part of the hold object and if there is I pass the hold object back to the function in a recursive function.
any part of that evaluates
True it does the front part which is
Which is the recursive part
Then if that did not return any
Trues it does the else statement
So it ends up returning
hold ending the function and giving us the data.
If you do not understand any part of that ask about it!
Best of luck!