code: def export_to_html(
      table, filename_or_fobj=None, encoding="utf-8", caption=False, *args, **kwargs
  ):
      
  
      serialized_table = serialize(table, *args, **kwargs)
      fields = next(serialized_table)
      result = ["<table>\n\n"]
      if caption and table.name:
          result.extend(["  <caption>", table.name, "</caption>\n\n"])
      result.extend(["  <thead>\n", "    <tr>\n"])
      # TODO: set @name/@id if self.meta["name"] is set
      header = ["      <th> {} </th>\n".format(field) for field in fields]
      result.extend(header)
      result.extend(["    </tr>\n", "  </thead>\n", "\n", "  <tbody>\n", "\n"])
      for index, row in enumerate(serialized_table, start=1):
          css_class = "odd" if index % 2 == 1 else "even"
          result.append('    <tr class="{}">\n'.format(css_class))
          for value in row:
              result.extend(["      <td> ", escape(value), " </td>\n"])
          result.append("    </tr>\n\n")
      result.append("  </tbody>\n\n</table>\n")
      html = "".join(result).encode(encoding)
  
      return export_data(filename_or_fobj, html, mode="wb")
docs: Export and return rows.Table data to HTML file.