def _table_exists(con, tablename, schema):
    """Return True if tablename exists."""
    cur = con.cursor()
    cur.execute(
        """
        SELECT EXISTS (
            SELECT TRUE FROM information_schema.tables
            WHERE
                table_schema=%s
                AND table_name=%s)
            """
        , [schema, tablename])
    return cur.fetchone()[0]
