code: def check_table_exists(dbcon, tablename):
      
      dbcur = dbcon.cursor()
      dbcur.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='%s';" % tablename)
      result = dbcur.fetchone()
      dbcur.close()
      if result is None:
          return False
      else:
          try:
              return result[0] == tablename
          except IndexError as e:
              return check_table_exists(dbcon, tablename)
docs: Check if a table exists in the database.
      :param dbcon: database connection
      :param tablename: table name
      :return: Boolean