code: def decorate(svg, node, metadata):
      """Add metedata next to a node"""
      if not metadata:
          return node
      xlink = metadata.get("xlink")
      if xlink:
          if not isinstance(xlink, dict):
              xlink = {"href": xlink, "target": "_blank"}
          node = svg.node(node, "a", **xlink)
          svg.node(node, "desc", class_="xlink").text = str(
              xlink.get("href")
          )
  
      if "tooltip" in metadata:
          svg.node(node, "title").text = str(metadata["tooltip"])
  
      if "color" in metadata:
          color = metadata.pop("color")
          node.attrib["style"] = "fill: %s; stroke: %s" % (color, color)
  
      if "style" in metadata:
          node.attrib["style"] = metadata.pop("style")
  
      if "label" in metadata and metadata["label"]:
          svg.node(node, "desc", class_="label").text = str(
              metadata["label"]
          )
      return node
  
imports: from __future__ import division
  import re
  from decimal import Decimal
  from math import ceil, cos, floor, log10, pi, sin
label_desc: Use image node_id 17 for calling a global function with example usage: decorate(svg, node, metadata) and returns: node, node