code: def generate_attrs_docstring(cls_name, attrs, doc_items):
      """
      Generates docstring for the attributes based on the documentation items provided.
  
      Raises
      ------
      Exception
          If any attribute is not found in the documentation items.
      """
      attrs_docstring = []
      for attr in attrs:
          if attr in doc_items:
              attrs_docstring.append(
                  f"{attr} : {doc_items[attr]['type']}\n{wrap_text(doc_items[attr]['desp'])}\n"
              )
          else:
              raise Exception(
                  f"Attribute {attr} not found in param file for class {cls_name}"
              )
      return f"\nAttributes\n----------\n{''.join(attrs_docstring)}"[
          :-1
      ]
  
imports: import ast
  import json
  import re
  import argparse
  import textwrap
  import os
  from collections import defaultdict
label_desc: Use image node_id 8 for calling a global function with example usage: generate_attrs_docstring(cls_name, attrs, doc_items) and returns: str, str