code: def _html_string(self):
      contig_idx = {
          contig: i for i, contig in enumerate(self.rg.contigs)
      }
  
      import html
  
      builder = []
      builder.append("<p><b>Variant summary:</b></p>")
      builder.append("<ul>")
      builder.append(
          f"<li><p>Total variants: {self.n_variants}</p></li>"
      )
  
      builder.append("<li><p>Alleles per variant:</p>")
      builder.append('<table><thead style="font-weight: bold;">')
      builder.append(
          "<tr><th>Number of alleles</th><th>Count</th></tr></thead><tbody>"
      )
      for n_alleles, count in sorted(
          self.alleles_per_variant.items(), key=lambda x: x[0]
      ):
          builder.append("<tr>")
          builder.append(f"<td>{n_alleles}</td>")
          builder.append(f"<td>{count}</td>")
          builder.append("</tr>")
      builder.append("</tbody></table>")
      builder.append("</li>")
  
      builder.append("<li><p>Counts by allele type:</p>")
      builder.append('<table><thead style="font-weight: bold;">')
      builder.append(
          "<tr><th>Allele type</th><th>Count</th></tr></thead><tbody>"
      )
      for allele_type, count in Counter(
          self.allele_types
      ).most_common():
          builder.append("<tr>")
          builder.append(f"<td>{html.escape(allele_type)}</td>")
          builder.append(f"<td>{count}</td>")
          builder.append("</tr>")
      builder.append("</tbody></table>")
      builder.append("</li>")
  
      builder.append("<li><p>Transitions/Transversions:</p>")
      builder.append('<table><thead style="font-weight: bold;">')
      builder.append(
          "<tr><th>Metric</th><th>Value</th></tr></thead><tbody>"
      )
      builder.append(
          f"<tr><td>Transitions</td><td>{self.nti}</td></tr>"
      )
      builder.append(
          f"<tr><td>Transversions</td><td>{self.ntv}</td></tr>"
      )
      builder.append(
          f"<tr><td>Ratio</td><td>{self.nti / self.ntv:.2f}</td></tr>"
      )
      builder.append("</tbody></table>")
      builder.append("</li>")
  
      builder.append("<li><p>Variants per contig:</p>")
      builder.append('<table><thead style="font-weight: bold;">')
      builder.append(
          "<tr><th>Contig</th><th>Count</th></tr></thead><tbody>"
      )
      for contig, count in sorted(
          self.variants_per_contig.items(),
          key=lambda x: contig_idx[x[0]],
      ):
          builder.append("<tr>")
          builder.append(f"<td>{html.escape(contig)}</td>")
          builder.append(f"<td>{count}</td>")
          builder.append("</tr>")
      builder.append("</tbody></table>")
      builder.append("</li>")
  
      builder.append("</ul>")
      return "".join(builder)
  
imports: import abc
  import logging
  import hail
  from collections import Counter
  import os
  from shlex import quote
  from typing import Dict, Tuple, List, Optional, Union
  from hailtop import pip_version
  from hailtop.utils import async_to_blocking
  import hailtop.batch_client
  from hailtop.config import get_deploy_config
  from hailtop import yamlx
  from hail.backend.service_backend import ServiceBackend
  from hail.typecheck import typecheck, oneof, anytype, nullable, numeric
  from hail.expr.expressions.expression_typecheck import expr_float64
  from hail.utils import FatalError
  from hail.utils.java import Env, info, warning
  from hail.utils.misc import divide_null, guess_cloud_spark_provider, new_temp_file
  from hail.matrixtable import MatrixTable
  from hail.table import Table
  from hail.ir import TableToTableApply
  from .misc import require_biallelic, require_row_key_variant, require_col_key_str, require_table_key_variant, require_alleles_field
label_desc: Use image node_id 5 for calling the _VariantSummary obj's underlying member method code with example usage: obj._html_string() and returns: str