def get_table_html(table, highlighted_cells):
  """Get html for a table and a subset of highlighted cells."""
  table_str = "<table>\n"
  for r_index, row in enumerate(table):
    row_str = "<tr> "
    for c_index, cell in enumerate(row):
      if [r_index, c_index] in highlighted_cells:
        cell_html = get_cell_html(cell, True)
      else:
        cell_html = get_cell_html(cell, False)
      row_str += cell_html

    row_str += "</tr>\n"
    table_str += row_str

  table_str += "</table>"
  return table_str
Get html for a table and a subset of highlighted cells.
language/totto/table_to_text_html_utils.py