def flatten(x):
result = []<EOL>for el in x:<EOL><INDENT>if hasattr(el, "<STR_LIT>") and not isinstance(el, basestring):<EOL><INDENT>result.extend(flatten(el))<EOL><DEDENT>else:<EOL><INDENT>result.append(el)<EOL><DEDENT><DEDENT>return result<EOL>
Flattens a nested array into a single list

:param list x: The nested list/tuple to be flattened.