def query_value(stmt, args=(), default=None):
    """
    Execute a query, returning the first value in the first row of the
    result set. If the query returns no result set, a default value is
    returned, which is `None` by default.
    """
    for row in query(stmt, args, TupleFactory):
        return row[0]
    return default
def query_value ( stmt , args = ( ) , default = None ) : for row in query ( stmt , args , TupleFactory ) : return row [ 0 ] return default
Execute a query, returning the first value in the first row of the
    result set. If the query returns no result set, a default value is
    returned, which is `None` by default.