def METHOD_NAME(self, node):
    prot = node.attributes["prot"].value
    id = node.attributes["id"].value
    kind = node.attributes["kind"].value
    tmp = node.parentNode.parentNode.parentNode
    compdef = tmp.getElementsByTagName("compounddef")[0]
    cdef_kind = compdef.attributes["kind"].value
    if prot == "public":
        first = self.get_specific_nodes(node, ("definition", "name"))
        name = first["name"].firstChild.data
        if name[:8] == "operator":  # Don't handle operators yet.
            return
        # store self.pieces to be able to restore it if the docstring is empty.
        pieces_backup = list(self.pieces)
        defn = first["definition"].firstChild.data
        self.add_text("\n")
        self.add_text('%feature("docstring") ')
        anc = node.parentNode.parentNode
        if cdef_kind in ("file", "namespace"):
            ns_node = anc.getElementsByTagName("innernamespace")
            if not ns_node and cdef_kind == "namespace":
                ns_node = anc.getElementsByTagName("compoundname")
            if ns_node:
                ns = ns_node[0].firstChild.data
                self.add_text(f' {ns}::{name} "\n{defn}')
            else:
                self.add_text(f' {name} "\n{defn}')
        elif cdef_kind in ("class", "struct"):
            # Get the full function name.
            anc_node = anc.getElementsByTagName("compoundname")
            cname = self.cpp_to_swig_name(anc_node[0].firstChild.data)
            # self.add_text(' %s::%s "\n%s'%(cname, name, defn))
            self.add_text(f' {cname}::{name} "')
            # print("***", name, defn)
        # make sure that the docstring won't be empty before writing any text
        current_length = len(self.pieces)
        for n in node.childNodes:
            # if n not in first.values():
            if n not in first.values() and (
                n.__class__.__name__ != "Element" or "description" in n.tagName
            ):
                self.parse(n)
        # make sure that the docstring won't be empty before writing any text
        if current_length == len(self.pieces):
            # restore the old self.pieces
            self.pieces = pieces_backup
        else:
            self.add_text(['";', "\n"])