def is_valid_table_name(cur, table_name):
    """
    Checks whether a name is for a table in the database.
    Note: Copied from utils.database for use in testing, to avoid
    a circular dependency between tests and implementation.
    Args:
        cur: sqlite3 database cursor object
        table_name (str): name to check
    Returns:
        True if valid, False otherwise
    """
    query = """
        SELECT 1
        FROM sqlite_master
        WHERE type == 'table'
        AND name == ?
    """
    res = cur.execute(query, (table_name,))
    return res.fetchone() is not None