code: def doc_class(cls):
      print(".. class :: %s" % cls.__name__)
      print()
      if cls.__name__.startswith("gl_"):
          print(
              "    Only available when PyOpenCL is compiled with GL support."
          )
          print("    See :func:`have_gl`.")
          print()
  
      if cls in cls_ext_lookup:
          for ln in get_extra_lines(cls_ext_lookup[cls]):
              print(ln)
  
      cls_const_ext = const_ext_lookup.get(cls, {})
      for name in sorted(dir(cls)):
          if not name.startswith("_") and name not in [
              "to_string",
              "names",
              "values",
          ]:
              print("    .. attribute :: %s" % name)
  
              if name in cls_const_ext:
                  for ln in get_extra_lines(cls_const_ext[name]):
                      print("    " + ln)
  
      print("    .. method :: to_string(value)")
      print()
      print("        Returns a :class:`str` representing *value*.")
      print()
      print("        .. versionadded:: 0.91")
      print()
  
label_desc: Use image node_id 2 for calling a global function with example usage: doc_class(cls) without return types