input: def display_table_from_db_to_html(database_query_function) -> str:
      """Given a function that queries a database and returns data, this function will return an HTML page that displays a table of contents using the data.
      The database_query_function should be a callable that returns a list of dictionaries, where each dictionary represents a row in the table and each key in the dictionary represents a column name.
      The returned HTML page will be a string that can be served directly to a client.
      
      Example:
      >>> def sample_query():
      ...     return [
      ...         {'Chapter': '1', 'Title': 'Introduction'},
      ...         {'Chapter': '2', 'Title': 'Background'},
      ...         {'Chapter': '3', 'Title': 'Methods'}
      ...     ]
      >>> print(display_table_from_db_to_html(sample_query))
      <!DOCTYPE html>
      <html>
      <head>
          <title>Table of Contents</title>
      </head>
      <body>
          <table>
              <tr>
                  <th>Chapter</th>
                  <th>Title</th>
              </tr>
              <tr>
                  <td>1</td>
                  <td>Introduction</td>
              </tr>
              <tr>
                  <td>2</td>
                  <td>Background</td>
              </tr>
              <tr>
                  <td>3</td>
                  <td>Methods</td>
              </tr>
          </table>
      </body>
      </html>
      """
      data = database_query_function()
      if not data:
          return "<!DOCTYPE html><html><head><title>Table of Contents</title></head><body><p>No data available</p></body></html>"
      
      html = "<!DOCTYPE html><html><head><title>Table of Contents</title></head><body><table>"
      headers = data[0].keys()
      html += "<tr>"
      for header in headers:
          html += f"<th>{header}</th>"
      html += "</tr>"
      
      for row in data:
          html += "<tr>"
          for key in headers:
              html += f"<td>{row[key]}</td>"
          html += "</tr>"
      html += "</table></body></html>"
      
      return html
output:     data = database_query_function()
      if not data:
          return "<!DOCTYPE html><html><head><title>Table of Contents</title></head><body><p>No data available</p></body></html>"
      
      html = "<!DOCTYPE html><html><head><title>Table of Contents</title></head><body><table>"
      headers = data[0].keys()
      html += "<tr>"
      for header in headers:
          html += f"<th>{header}</th>"
      html += "</tr>"
      
      for row in data:
          html += "<tr>"
          for key in headers:
              html += f"<td>{row[key]}</td>"
          html += "</tr>"
      html += "</table></body></html>"
      
      return html