code: def create_node(self, result):
      res_role, newnode = result
      # Override "any" class with the actual role type to get the styling
      # approximately correct.
      res_domain = res_role.split(":")[0]
      if (
          len(newnode) > 0
          and isinstance(newnode[0], nodes.Element)
          and newnode[0].get("classes")
      ):
          newnode[0]["classes"].append(res_domain)
          newnode[0]["classes"].append(res_role.replace(":", "-"))
      return newnode
  
file_path: scikit-optimize/doc/sphinxext/custom_references_resolver.py
imports: from contextlib import suppress
  from docutils import nodes
  from sphinx.transforms.post_transforms import ReferencesResolver
label_desc: Use image node_id 2 for calling the CustomReferencesResolver obj's underlying member method code with example usage: obj.create_node(result) and returns: newnode