code: def class2md(self, cls, depth=2):
          
  
          section = "#" * depth
          subsection = "#" * (depth + 2)
          clsname = cls.__name__
          modname = cls.__module__
          header = clsname
          path = self.get_src_path(cls)
          doc = self.doc2md(cls)
  
          try:
              init = self.func2md(cls.__init__, clsname=clsname)
          except (ValueError, TypeError):
              # this happens if __init__ is outside the repo
              init = ""
  
          variables = []
          for name, obj in getmembers(cls, lambda a: not (inspect.isroutine(a) or inspect.ismethod(a))):
              if not name.startswith("_") and type(obj) == property:
                  comments = self.doc2md(obj) or inspect.getcomments(obj)
                  comments = "\n %s" % comments if comments else ""
                  variables.append("\n%s %s.%s%s\n" % (subsection, clsname, name, comments))
  
          handlers = []
          for name, obj in getmembers(cls, inspect.ismethoddescriptor):
              if not name.startswith("_") and hasattr(obj, "__module__") and obj.__module__ == modname:
                  handlers.append("\n%s %s.%s\n *Handler*" % (subsection, clsname, name))
  
          methods = []
          for name, obj in getmembers(cls, inspect.ismethod):
              if not name.startswith("_") and hasattr(obj,
                                                      "__module__") and obj.__module__ == modname and name not in handlers:
                  methods.append(self.func2md(obj, clsname=clsname, depth=depth + 1))
  
          string = CLASS_TEMPLATE.format(section=section,
                                         header=header,
                                         path=path,
                                         doc=doc if doc else "",
                                         init=init,
                                         variables="".join(variables),
                                         handlers="".join(handlers),
                                         methods="".join(methods))
          return string
docs: Takes a class and creates markdown text to document its methods and variables.