input: Write a python function to generate an HTML table from a SQLite database query.
  assert generate_html_table('Fantasy') == '<table><tr><th>Title</th><th>Author</th><th>Genre</th><th>Sales</th></tr><tr><td>Harry Potter</td><td>J.K. Rowling</td><td>Fantasy</td><td>1200000</td></tr><tr><td>The Hobbit</td><td>J.R.R. Tolkien</td><td>Fantasy</td><td>1000000</td></tr></table>'
  assert generate_html_table('Science Fiction') == '<table><tr><th>Title</th><th>Author</th><th>Genre</th><th>Sales</th></tr><tr><td>Dune</td><td>Frank Herbert</td><td>Science Fiction</td><td>500000</td></tr></table>'
output: def generate_html_table(genre):
      import sqlite3
  
      # Connect to the SQLite database
      conn = sqlite3.connect(':memory:')
      cursor = conn.cursor()
  
      # Create a table and insert some test data
      cursor.execute('''
          CREATE TABLE books (
              title TEXT,
              author TEXT,
              genre TEXT,
              sales INTEGER
          )
      ''')
      cursor.executemany('''
          INSERT INTO books (title, author, genre, sales) VALUES (?, ?, ?, ?)
      ''', [
          ('Harry Potter', 'J.K. Rowling', 'Fantasy', 1200000),
          ('The Hobbit', 'J.R.R. Tolkien', 'Fantasy', 1000000),
          ('Dune', 'Frank Herbert', 'Science Fiction', 500000)
      ])
      conn.commit()
  
      # Query the data based on genre
      cursor.execute('SELECT title, author, genre, sales FROM books WHERE genre = ?', (genre,))
      rows = cursor.fetchall()
  
      # Generate HTML table
      html = '<table>'
      html += '<tr><th>Title</th><th>Author</th><th>Genre</th><th>Sales</th></tr>'
      for row in rows:
          html += '<tr>'
          html += ''.join(f'<td>{col}</td>' for col in row)
          html += '</tr>'
      html += '</table>'
  
      # Close the database connection
      conn.close()
  
      return html