def METHOD_NAME(query_df):  # sourcery skip: identity-comprehension
    """Generate query list document."""
    doc_lines = [
        "Data Queries Reference",
        "=" * len("Data Queries Reference"),
        "",
        "",
    ]
    # This line fails if re-written as dict(query_df.groupby("Environment"))
    # pylint: disable=unnecessary-comprehension
    group_dict = {name: group for name, group in query_df.groupby("Environment")}
    for name, friendly_name in PROVIDERS.items():
        if name not in group_dict:
            continue
        grp = group_dict[name]
        doc_lines.append(f"Queries for {friendly_name}")
        doc_lines.append("-" * len(f"Queries for {friendly_name}"))
        doc_lines.append(f"\nData Environment identifier: {name}\n")
        tbl_txt = tabulate(
            grp.drop(columns="Environment"),
            headers="keys",
            showindex="never",
            tablefmt="rst",
        )
        tbl_txt = [line.strip() for line in tbl_txt.split("\n")]
        doc_lines.extend(tbl_txt)
        doc_lines.append("\n\n")
    return "\n".join(doc_lines)