input: Write a Python function to generate an HTML table displaying information about the top 10 bestselling books in a specific genre from a SQLite database. The function should accept the database connection, genre, and table name as parameters. It should return the HTML table as a string. If the genre does not exist in the database, the function should return an empty string.
  
  def generate_bestselling_html_table(conn, genre, table_name):
      c = conn.cursor()
      c.execute(f'''SELECT title, author, genre, sales
                   FROM {table_name}
                   WHERE genre=?
                   ORDER BY sales DESC
                   LIMIT 10''', (genre,))
      results = c.fetchall()
  
      if not results:
          return ''
  
      html = '<table>'
      html += '<tr><th>Title</th><th>Author</th><th>Genre</th><th>Sales</th></tr>'
  
      for result in results:
          title = result[0]
          author = result[1]
          genre = result[2]
          sales = result[3]
          html += f'<tr><td>{title}</td><td>{author}</td><td>{genre}</td><td>{sales}</td></tr>'
  
      html += '</table>'
      return html
  
  assert generate_bestselling_html_table(conn, 'Fantasy', 'Books') == '<table><tr><th>Title</th><th>Author</th><th>Genre</th><th>Sales</th></tr><tr><td>Book1</td><td>Author1</td><td>Fantasy</td><td>10000</td></tr><tr><td>Book2</td><td>Author2</td><td>Fantasy</td><td>9000</td></tr></table>'
  assert generate_bestselling_html_table(conn, 'Mystery', 'Books') == ''
  assert generate_bestselling_html_table(conn, 'Romance', 'Books') == '<table><tr><th>Title</th><th>Author</th><th>Genre</th><th>Sales</th></tr><tr><td>Book3</td><td>Author3</td><td>Romance</td><td>8000</td></tr></table>'
output: def generate_bestselling_html_table(conn, genre, table_name):
      c = conn.cursor()
      c.execute(f'''SELECT title, author, genre, sales
                   FROM {table_name}
                   WHERE genre=?
                   ORDER BY sales DESC
                   LIMIT 10''', (genre,))
      results = c.fetchall()
  
      if not results:
          return ''
  
      html = '<table>'
      html += '<tr><th>Title</th><th>Author</th><th>Genre</th><th>Sales</th></tr>'
  
      for result in results:
          title = result[0]
          author = result[1]
          genre = result[2]
          sales = result[3]
          html += f'<tr><td>{title}</td><td>{author}</td><td>{genre}</td><td>{sales}</td></tr>'
  
      html += '</table>'
      return html