input: Write a function named create_toc_html that generates an HTML page displaying a table of contents from data stored in a database. The function should accept a database connection as input and return the full HTML content as a string.
  assert create_toc_html(valid_db_connection)=='<html><body><ul><li>Chapter 1</li><li>Chapter 2</li></ul></body></html>'
  assert create_toc_html(invalid_db_connection)=='<html><body><p>Failed to retrieve table of contents.</p></body></html>'
  assert create_toc_html(None)=='<html><body><p>Failed to retrieve table of contents.</p></body></html>'
output: def create_toc_html(db_connection):
      if db_connection is None:
          return '<html><body><p>Failed to retrieve table of contents.</p></body></html>'
      try:
          cursor = db_connection.cursor()
          cursor.execute("SELECT chapter_name FROM chapters")
          chapters = cursor.fetchall()
          if not chapters:
              return '<html><body><p>Failed to retrieve table of contents.</p></body></html>'
          html_content = '<html><body><ul>'
          for chapter in chapters:
              html_content += f'<li>{chapter[0]}</li>'
          html_content += '</ul></body></html>'
          return html_content
      except:
          return '<html><body><p>Failed to retrieve table of contents.</p></body></html>'