docs: def draw(canvas, mol):
      """Draw molecule structure image.
  
      Args:
          canvas: draw.drawable.Drawable
          mol: model.graphmol.Compound
      """
      mol.require("ScaleAndCenter")
      mlb = mol.size2d[2]
      if not mol.atom_count():
          return
      bond_type_fn = {
          1: {
              0: single_bond,
              1: wedged_single,
              2: dashed_wedged_single,
              3: wave_single,
          }, 2: {
              0: cw_double,
              1: counter_cw_double,
              2: double_bond,
              3: cross_double
          }, 3: {
              0: triple_bond
          }
      }
      # Draw bonds
      for u, v, bond in mol.bonds_iter():
          if not bond.visible:
              continue
          if (u < v) == bond.is_lower_first:
              f, s = (u, v)
          else:
              s, f = (u, v)
          p1 = mol.atom(f).coords
          p2 = mol.atom(s).coords
          if p1 == p2:
              continue  # avoid zero division
          if mol.atom(f).visible:
              p1 = gm.t_seg(p1, p2, F_AOVL, 2)[0]
          if mol.atom(s).visible:
              p2 = gm.t_seg(p1, p2, F_AOVL, 1)[1]
          color1 = mol.atom(f).color
          color2 = mol.atom(s).color
          bond_type_fn[bond.order][bond.type](
              canvas, p1, p2, color1, color2, mlb)
  
      # Draw atoms
      for n, atom in mol.atoms_iter():
          if not atom.visible:
              continue
          p = atom.coords
          color = atom.color
          # Determine text direction
          if atom.H_count:
              cosnbrs = []
              hrzn = (p[0] + 1, p[1])
              for nbr in mol.graph.neighbors(n):
                  pnbr = mol.atom(nbr).coords
                  try:
                      cosnbrs.append(gm.dot_product(hrzn, pnbr, p) /
                                     gm.distance(p, pnbr))
                  except ZeroDivisionError:
                      pass
              if not cosnbrs or min(cosnbrs) > 0:
                  # [atom]< or isolated node(ex. H2O, HCl)
                  text = atom.formula_html(True)
                  canvas.draw_text(p, text, color, "right")
                  continue
              elif max(cosnbrs) < 0:
                  # >[atom]
                  text = atom.formula_html()
                  canvas.draw_text(p, text, color, "left")
                  continue
          # -[atom]- or no hydrogens
          text = atom.formula_html()
          canvas.draw_text(p, text, color, "center")