def process_needtables(app, doctree, fromdocname):
env = app.builder.env<EOL>for node in doctree.traverse(Needtable):<EOL><INDENT>if not app.config.needs_include_needs:<EOL><INDENT>for att in ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>node[att] = []<EOL><DEDENT>node.replace_self([])<EOL>continue<EOL><DEDENT>id = node.attributes["<STR_LIT>"][<NUM_LIT:0>]<EOL>current_needtable = env.need_all_needtables[id]<EOL>all_needs = env.needs_all_needs<EOL>if current_needtable["<STR_LIT>"] == "<STR_LIT>" or current_needtable["<STR_LIT>"].upper() not in ["<STR_LIT>", "<STR_LIT>"]:<EOL><INDENT>if app.config.needs_table_style == "<STR_LIT>":<EOL><INDENT>style = "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>style = app.config.needs_table_style.upper()<EOL><DEDENT><DEDENT>else:<EOL><INDENT>style = current_needtable["<STR_LIT>"].upper()<EOL><DEDENT>classes = ["<STR_LIT>".format(style=style)]<EOL>content = nodes.table(classes=classes)<EOL>tgroup = nodes.tgroup()<EOL>for col in current_needtable["<STR_LIT>"]:<EOL><INDENT>if col == "<STR_LIT>":<EOL><INDENT>tgroup += nodes.colspec(colwidth=<NUM_LIT:15>)<EOL><DEDENT>else:<EOL><INDENT>tgroup += nodes.colspec(colwidth=<NUM_LIT:5>)<EOL><DEDENT><DEDENT>node_columns = []<EOL>for col in current_needtable["<STR_LIT>"]:<EOL><INDENT>header_name = col.title() if col != "<STR_LIT>" else col<EOL>header_name = header_name.replace("<STR_LIT:_>", "<STR_LIT:U+0020>")<EOL>node_columns.append(nodes.entry('<STR_LIT>', nodes.paragraph('<STR_LIT>', header_name)))<EOL><DEDENT>tgroup += nodes.thead('<STR_LIT>', nodes.row(<EOL>'<STR_LIT>', *node_columns))<EOL>tbody = nodes.tbody()<EOL>tgroup += tbody<EOL>content += tgroup<EOL>all_needs = list(all_needs.values())<EOL>if current_needtable["<STR_LIT>"] is not None:<EOL><INDENT>if current_needtable["<STR_LIT>"] == "<STR_LIT:id>":<EOL><INDENT>all_needs = sorted(all_needs, key=lambda node: node["<STR_LIT:id>"])<EOL><DEDENT>elif current_needtable["<STR_LIT>"] == "<STR_LIT:status>":<EOL><INDENT>all_needs = sorted(all_needs, key=status_sorter)<EOL><DEDENT><DEDENT>found_needs = procces_filters(all_needs, current_needtable)<EOL>for need_info in found_needs:<EOL><INDENT>temp_need = need_info.copy()<EOL>if temp_need['<STR_LIT>']:<EOL><INDENT>row = nodes.row(classes=['<STR_LIT>'])<EOL>prefix = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>row = nodes.row(classes=['<STR_LIT>'])<EOL>temp_need['<STR_LIT:id>'] = temp_need['<STR_LIT>']<EOL>prefix = app.config.needs_part_prefix<EOL>temp_need['<STR_LIT:title>'] = temp_need['<STR_LIT:content>']<EOL><DEDENT>for col in current_needtable["<STR_LIT>"]:<EOL><INDENT>if col == "<STR_LIT>":<EOL><INDENT>row += row_col_maker(app, fromdocname, env.needs_all_needs, temp_need, "<STR_LIT:id>", make_ref=True,<EOL>prefix=prefix)<EOL><DEDENT>elif col == "<STR_LIT>":<EOL><INDENT>row += row_col_maker(<EOL>app, fromdocname, env.needs_all_needs, temp_need, "<STR_LIT:title>",<EOL>prefix=app.config.needs_part_prefix)<EOL><DEDENT>elif col == "<STR_LIT>":<EOL><INDENT>row += row_col_maker(app, fromdocname, env.needs_all_needs, temp_need,<EOL>"<STR_LIT>", ref_lookup=True)<EOL><DEDENT>elif col == "<STR_LIT>":<EOL><INDENT>row += row_col_maker(app, fromdocname, env.needs_all_needs, temp_need, "<STR_LIT>", ref_lookup=True)<EOL><DEDENT>else:<EOL><INDENT>row += row_col_maker(app, fromdocname, env.needs_all_needs, temp_need, col.lower())<EOL><DEDENT><DEDENT>tbody += row<EOL>if current_needtable["<STR_LIT>"] and need_info['<STR_LIT>']:<EOL><INDENT>for key, part in need_info["<STR_LIT>"].items():<EOL><INDENT>row = nodes.row(classes=['<STR_LIT>'])<EOL>temp_part = part.copy()  <EOL>temp_part['<STR_LIT>'] = need_info['<STR_LIT>']<EOL>for col in current_needtable["<STR_LIT>"]:<EOL><INDENT>if col == "<STR_LIT>":<EOL><INDENT>temp_part['<STR_LIT:id>'] = '<STR_LIT:.>'.join([need_info['<STR_LIT:id>'], part['<STR_LIT:id>']])<EOL>row += row_col_maker(<EOL>app, fromdocname, env.needs_all_needs, temp_part, "<STR_LIT:id>",<EOL>make_ref=True, prefix=app.config.needs_part_prefix)<EOL><DEDENT>elif col == "<STR_LIT>":<EOL><INDENT>row += row_col_maker(<EOL>app, fromdocname, env.needs_all_needs, temp_part, "<STR_LIT:content>",<EOL>prefix=app.config.needs_part_prefix)<EOL><DEDENT>elif col == "<STR_LIT>":<EOL><INDENT>row += row_col_maker(<EOL>app, fromdocname, env.needs_all_needs, temp_part, "<STR_LIT>", ref_lookup=True)<EOL><DEDENT>else:<EOL><INDENT>row += row_col_maker(<EOL>app, fromdocname, env.needs_all_needs, temp_part, col.lower())<EOL><DEDENT><DEDENT>tbody += row<EOL><DEDENT><DEDENT><DEDENT>if len(found_needs) == <NUM_LIT:0>:<EOL><INDENT>content.append(no_needs_found_paragraph())<EOL><DEDENT>if current_needtable["<STR_LIT>"]:<EOL><INDENT>content.append(used_filter_paragraph(current_needtable))<EOL><DEDENT>node.replace_self(content)<EOL><DEDENT>
Replace all needtables nodes with a tale of filtered noded.

:param app:
:param doctree:
:param fromdocname:
:return: