code: def table_exists(conn, name):
      return bool(
          conn.execute(
              """
          with all_tables as (
              select name from sqlite_master where type = 'table'
                       union all
              select name from temp.sqlite_master where type = 'table'
          )
          select 1 from all_tables where name = ?
          """,
              (name,),
          ).fetchall(),
      )
  
file_path: datasette/tests/test_internals_database.py
imports: from datasette.app import Datasette
  from datasette.database import Database, Results, MultipleValues
  from datasette.utils.sqlite import sqlite3
  from datasette.utils import Column
  from .fixtures import app_client, app_client_two_attached_databases_crossdb_enabled
  import pytest
  import time
  import uuid
label_desc: Use image node_id 2 for calling a global function with example usage: table_exists(conn, name) and returns: bool