def make_flatten(decl_or_decls):
def proceed_single(decl):<EOL><INDENT>answer = [decl]<EOL>if not isinstance(decl, scopedef_t):<EOL><INDENT>return answer<EOL><DEDENT>for elem in decl.declarations:<EOL><INDENT>if isinstance(elem, scopedef_t):<EOL><INDENT>answer.extend(proceed_single(elem))<EOL><DEDENT>else:<EOL><INDENT>answer.append(elem)<EOL><DEDENT><DEDENT>return answer<EOL><DEDENT>decls = []<EOL>if isinstance(decl_or_decls, list):<EOL><INDENT>decls.extend(decl_or_decls)<EOL><DEDENT>else:<EOL><INDENT>decls.append(decl_or_decls)<EOL><DEDENT>answer = []<EOL>for decl in decls:<EOL><INDENT>answer.extend(proceed_single(decl))<EOL><DEDENT>return answer<EOL>
Converts tree representation of declarations to flatten one.

:param decl_or_decls: reference to list of declaration's or single
    declaration
:type decl_or_decls: :class:`declaration_t` or [ :class:`declaration_t` ]
:rtype: [ all internal declarations ]