def METHOD_NAME(
    postgres_db: sa.engine.Engine,
) -> Iterator[Callable[..., dict]]:
    to_remove = []
    def creator(
        group_id: int, has_internet_access: bool, product_name: str = None
    ) -> dict[str, Any]:
        with postgres_db.connect() as con:
            groups_extra_properties_config = {
                "group_id": group_id,
                "internet_access": has_internet_access,
            }
            if product_name:
                groups_extra_properties_config["product_name"] = product_name
            con.execute(
                groups_extra_properties.insert()
                .values(groups_extra_properties_config)
                .returning(sa.literal_column("*"))
            )
            # this is needed to get the primary_gid correctly
            result = con.execute(
                sa.select(groups_extra_properties).where(
                    groups_extra_properties.c.group_id == group_id
                )
            )
            entry = result.first()
            assert entry
            print(f"--> created {entry=}")
            to_remove.append(group_id)
        return dict(entry)
    yield creator
    with postgres_db.connect() as con:
        con.execute(
            groups_extra_properties.delete().where(
                groups_extra_properties.c.group_id.in_(to_remove)
            )
        )
    print(f"<-- deleted groups_extra_properties {to_remove=}")